Working unit tests, holey moley

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2022-03-04 13:47:56 -05:00 committed by Sonu Saha
parent 6a39ed74a1
commit 638522f0e0
2 changed files with 21 additions and 3 deletions

View file

@ -1 +1,19 @@
# Some unit test code
# If we can load the InSpec globals definition file...
require "inspec/globals"
# ... we can find the core test unit helper file
require "#{Inspec.src_root}/test/helper"
# Load (require) the resource library file
# TODO: core path change
require_relative "../../libraries/<%= resource_name %>.rb"
describe Inspec::Resources::<%= class_name %> do
it "works correctly with the constructor on the platform" do
# Add contructor arguments to load_resource if needed
resource = MockLoader.new("<%= supports_platform %>".to_sym).load_resource("<%= resource_name %>")
_(resource.has_bells?).must_equal true
_(resource.shoe_size).must_equal 42
_(resource.resource_id).must_equal "something special"
end
end

View file

@ -68,8 +68,8 @@ require "webmock/minitest"
require "mocha/minitest"
require "inspec/log"
require "inspec/backend"
require "helpers/mock_loader"
require "helpers/resources"
require_relative "helpers/mock_loader"
require_relative "helpers/resources"
TMP_CACHE = {} # rubocop: disable Style/MutableConstant