Basic unit tests for plugin definition

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2020-05-23 13:55:46 -04:00 committed by Mary Jinglewski
parent bb2dfaa02d
commit 81e2f36fde
2 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,20 @@
require_relative "../../../shared/core_plugin_test_helper.rb"
require_relative "../../lib/inspec-reporter-html2"
describe InspecPlugins::Html2Reporter::Plugin do
let(:plugin_name) { :'inspec-reporter-html2' }
let(:registry) { Inspec::Plugin::V2::Registry.instance }
let(:status) { registry[plugin_name] }
it "should be registered" do
registry.known_plugin?(plugin_name)
end
it "should be an api-v2 plugin" do
_(status.api_generation).must_equal(2)
end
it "should include a reporter activator hook" do
_(status.plugin_types).must_include(:reporter)
end
end

View file

@ -0,0 +1,26 @@
require_relative "../../../shared/core_plugin_test_helper.rb"
require_relative "../../lib/inspec-reporter-html2"
require_relative "../../lib/inspec-reporter-html2/reporter"
describe InspecPlugins::Html2Reporter::Reporter do
[
# API instance methods
:render,
].each do |api_method|
it "should implement a '#{api_method}' instance method" do
klass = InspecPlugins::Html2Reporter::Reporter
_(klass.method_defined?(api_method)).must_equal true
end
end
[
# API class methods
:run_data_schema_constraints
].each do |api_method|
it "should implement a '#{api_method}' class method" do
klass = InspecPlugins::Html2Reporter::Reporter
_(klass.singleton_methods).must_include(api_method)
end
end
end