2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
2019-05-02 04:25:02 +00:00
|
|
|
|
2019-07-27 19:46:11 +00:00
|
|
|
require "inspec/plugin/v2"
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Input plugin type" do
|
|
|
|
describe "when registering the plugin type superclass" do
|
|
|
|
it "returns the superclass when calling the global defintion method" do
|
2019-05-02 04:25:02 +00:00
|
|
|
klass = Inspec.plugin(2, :input)
|
2019-09-30 22:31:55 +00:00
|
|
|
_(klass).must_be_kind_of Class
|
|
|
|
_(klass).must_equal Inspec::Plugin::V2::PluginType::Input
|
2019-05-02 04:25:02 +00:00
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "returns the superclass when referenced by alias" do
|
2019-05-02 04:25:02 +00:00
|
|
|
klass = Inspec::Plugin::V2::PluginBase.base_class_for_type(:input)
|
2019-09-30 22:31:55 +00:00
|
|
|
_(klass).must_be_kind_of Class
|
|
|
|
_(klass).must_equal Inspec::Plugin::V2::PluginType::Input
|
2019-05-02 04:25:02 +00:00
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
it "registers an activation dsl method" do
|
2019-05-02 04:25:02 +00:00
|
|
|
klass = Inspec::Plugin::V2::PluginBase
|
2019-09-30 22:31:55 +00:00
|
|
|
_(klass).must_respond_to :input
|
2019-05-02 04:25:02 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "when examining the specific plugin type API" do
|
2019-05-02 04:25:02 +00:00
|
|
|
[
|
2019-05-02 23:47:00 +00:00
|
|
|
# API instance methods
|
|
|
|
:fetch,
|
|
|
|
:default_priority,
|
|
|
|
:list_inputs,
|
2019-05-02 04:25:02 +00:00
|
|
|
].each do |api_method|
|
2019-05-02 23:47:00 +00:00
|
|
|
it "should define a '#{api_method}' method in the superclass" do
|
|
|
|
klass = Inspec::Plugin::V2::PluginType::Input
|
2019-09-30 22:31:55 +00:00
|
|
|
_(klass.method_defined?(api_method)).must_equal true
|
2019-05-02 04:25:02 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-06-11 22:24:35 +00:00
|
|
|
end
|