mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
Take back the Inspec::Fetcher namespace
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
b39d47bda7
commit
80ef0eeeba
8 changed files with 11 additions and 11 deletions
|
@ -8,7 +8,7 @@ module Inspec
|
|||
attr_reader :cache, :target, :fetcher
|
||||
def initialize(target, cache)
|
||||
@target = target
|
||||
@fetcher = Inspec::Fetcher.resolve(target)
|
||||
@fetcher = Inspec::FetcherSystem.resolve(target)
|
||||
|
||||
if @fetcher.nil?
|
||||
raise("Could not fetch inspec profile in #{target.inspect}.")
|
||||
|
|
|
@ -26,7 +26,7 @@ module Inspec
|
|||
end
|
||||
end
|
||||
|
||||
Fetcher = FetcherRegistry.new
|
||||
FetcherSystem = FetcherRegistry.new
|
||||
|
||||
def self.fetcher(version)
|
||||
if version != 1
|
||||
|
|
|
@ -17,7 +17,7 @@ module Inspec
|
|||
#
|
||||
class Fetcher < PluginRegistry::Plugin
|
||||
def self.plugin_registry
|
||||
Inspec::Fetcher
|
||||
Inspec::FetcherSystem
|
||||
end
|
||||
|
||||
attr_accessor :target
|
||||
|
|
|
@ -4,7 +4,7 @@ require "bundles/inspec-supermarket/api"
|
|||
|
||||
describe "Inspec::Fetcher" do
|
||||
it "loads the local fetcher for this file" do
|
||||
res = Inspec::Fetcher.resolve(__FILE__)
|
||||
res = Inspec::FetcherSystem.resolve(__FILE__)
|
||||
_(res).must_be_kind_of Fetchers::Local
|
||||
end
|
||||
|
||||
|
@ -22,14 +22,14 @@ describe "Inspec::Fetcher" do
|
|||
end
|
||||
|
||||
it "defaults to supermarket if only a name is given" do
|
||||
res = Inspec::Fetcher.resolve({ name: "mock/test-profile" })
|
||||
res = Inspec::FetcherSystem.resolve({ name: "mock/test-profile" })
|
||||
res.expects(:open).returns(mock_open)
|
||||
_(res).must_be_kind_of Fetchers::Url
|
||||
_(res.resolved_source[:url]).must_equal("http://mock-url")
|
||||
end
|
||||
|
||||
it "ignores keys that might have come along for the ride" do
|
||||
res = Inspec::Fetcher.resolve({ name: "mock/test-profile", cwd: "/tmp/inspec-test", cache: "ancache", backend: "test-backend" })
|
||||
res = Inspec::FetcherSystem.resolve({ name: "mock/test-profile", cwd: "/tmp/inspec-test", cache: "ancache", backend: "test-backend" })
|
||||
_(res).must_be_kind_of Fetchers::Url
|
||||
end
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ describe "Inspec::Fetcher" do
|
|||
# simulate a local windows path
|
||||
file = __FILE__
|
||||
file.tr!("/", '\\')
|
||||
res = Inspec::Fetcher.resolve(file)
|
||||
res = Inspec::FetcherSystem.resolve(file)
|
||||
_(res).must_be_kind_of Fetchers::Local
|
||||
_(res.target).must_equal __FILE__
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ describe Fetchers::Git do
|
|||
let(:fetcher) { Fetchers::Git }
|
||||
|
||||
it "registers with the fetchers registry" do
|
||||
reg = Inspec::Fetcher.registry
|
||||
reg = Inspec::FetcherSystem.registry
|
||||
_(reg["git"]).must_equal fetcher
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ describe Fetchers::Local do
|
|||
let(:fetcher) { Fetchers::Local }
|
||||
|
||||
it "registers with the fetchers registry" do
|
||||
reg = Inspec::Fetcher.registry
|
||||
reg = Inspec::FetcherSystem.registry
|
||||
_(reg["local"]).must_equal fetcher
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ describe Fetchers::Mock do
|
|||
let(:fetcher) { Fetchers::Mock }
|
||||
|
||||
it "registers with the fetchers registry" do
|
||||
reg = Inspec::Fetcher.registry
|
||||
reg = Inspec::FetcherSystem.registry
|
||||
_(reg["mock"]).must_equal fetcher
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require "inspec/fetcher" # TODO: require fetchers/url directly
|
|||
|
||||
describe Fetchers::Url do
|
||||
it "registers with the fetchers registry" do
|
||||
reg = Inspec::Fetcher.registry
|
||||
reg = Inspec::FetcherSystem.registry
|
||||
_(reg["url"]).must_equal Fetchers::Url
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue