mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
0ddf1687f5
I hate to do this, but unit testing this reveals odd behavior in the fetcher - fetching in a unit harness appears to always succeed. I'd like to make this into a unit test, but for now I want to focus on the fetchers. Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
26 lines
951 B
Ruby
26 lines
951 B
Ruby
require "functional/helper"
|
|
|
|
describe "the fetchers" do
|
|
parallelize_me!
|
|
include FunctionalHelper
|
|
|
|
let(:looks_like_a_stacktrace) { %r{lib/inspec/.+\.rb:\d+:in} }
|
|
let(:invocation) { "exec #{path} --no-create-lockfile" }
|
|
let(:run_result) { inspec(invocation) }
|
|
|
|
# Refs #4726
|
|
describe "when fetchers fetch a bad dependency" do
|
|
let(:fetcher_profiles) { "#{profile_path}/fetcher-failures" }
|
|
|
|
describe "when using the local fetcher on a bad dep" do
|
|
let(:path) { "#{fetcher_profiles}/local-bad" }
|
|
it "should throw an exception not a stacktrace" do
|
|
_(run_result.stdout).must_be_empty
|
|
_(run_result.stderr).wont_match looks_like_a_stacktrace
|
|
_(run_result.stderr).must_match(/Profile dependency local path .+ does not exist/)
|
|
_(run_result.stderr).must_include "fetcher-failures/nonesuch" # path of the missing profile in message
|
|
assert_exit_code(1, run_result)
|
|
end
|
|
end
|
|
end
|
|
end
|