2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
2019-11-14 20:25:43 +00:00
|
|
|
require "inspec/fetchers/mock"
|
2016-03-17 22:00:55 +00:00
|
|
|
|
|
|
|
describe Fetchers::Mock do
|
|
|
|
let(:fetcher) { Fetchers::Mock }
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "registers with the fetchers registry" do
|
2019-11-15 21:23:00 +00:00
|
|
|
reg = Inspec::FetcherSystem.registry
|
2019-06-11 22:24:35 +00:00
|
|
|
_(reg["mock"]).must_equal fetcher
|
2016-03-17 22:00:55 +00:00
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "wont load nil" do
|
2019-09-30 22:31:55 +00:00
|
|
|
_(fetcher.resolve(nil)).must_be :nil?
|
2016-03-17 22:00:55 +00:00
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "wont load a string" do
|
2019-09-30 22:31:55 +00:00
|
|
|
_(fetcher.resolve(rand.to_s)).must_be :nil?
|
2016-03-17 22:00:55 +00:00
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "applied to a map" do
|
|
|
|
it "must be resolved" do
|
2019-09-30 22:31:55 +00:00
|
|
|
_(fetcher.resolve({})).must_be_kind_of fetcher
|
2016-03-17 22:00:55 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|