mirror of
https://github.com/inspec/inspec
synced 2024-11-22 12:43:07 +00:00
Plugin type declaration and unit test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
d4ae9e1e01
commit
82f910e320
2 changed files with 40 additions and 0 deletions
5
lib/inspec/plugin/v2/plugin_types/input.rb
Normal file
5
lib/inspec/plugin/v2/plugin_types/input.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
module Inspec::Plugin::V2::PluginType
|
||||
class Input < Inspec::Plugin::V2::PluginBase
|
||||
register_plugin_type(:input)
|
||||
end
|
||||
end
|
35
test/unit/plugin/v2/api_input.rb
Normal file
35
test/unit/plugin/v2/api_input.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
require 'helper'
|
||||
|
||||
describe 'Input plugin type' do
|
||||
describe 'when registering the plugin type superclass' do
|
||||
it 'returns the superclass when calling the global defintion method' do
|
||||
klass = Inspec.plugin(2, :input)
|
||||
klass.must_be_kind_of Class
|
||||
klass.name.must_equal 'Inspec::Plugin::V2::PluginType::Input'
|
||||
end
|
||||
|
||||
it 'returns the superclass when referenced by alias' do
|
||||
klass = Inspec::Plugin::V2::PluginBase.base_class_for_type(:input)
|
||||
klass.must_be_kind_of Class
|
||||
klass.name.must_equal 'Inspec::Plugin::V2::PluginType::Input'
|
||||
end
|
||||
|
||||
it 'registers an activation dsl method' do
|
||||
klass = Inspec::Plugin::V2::PluginBase
|
||||
klass.must_respond_to :input
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when examining the specific plugin type API' do
|
||||
[
|
||||
# TODO - API instance methods
|
||||
# fetch?
|
||||
# default_priority?
|
||||
].each do |api_method|
|
||||
it "should define an #{api_method} in the superclass" do
|
||||
klass = Inspec::Plugin::V2::PluginType::CliCommand
|
||||
klass.method_defined?(api_method).must_eq true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue