diff --git a/lib/bundles/inspec-habitat/profile.rb b/lib/bundles/inspec-habitat/profile.rb index 9fe8fe88d..424d089a8 100644 --- a/lib/bundles/inspec-habitat/profile.rb +++ b/lib/bundles/inspec-habitat/profile.rb @@ -31,6 +31,7 @@ module Habitat def initialize(path, options = {}) @path = path @options = options + @cli_config = nil log_level = options.fetch('log_level', 'info') Habitat::Log.level(log_level.to_sym) diff --git a/lib/inspec/profile.rb b/lib/inspec/profile.rb index 3b5ba8fcb..ef569117f 100644 --- a/lib/inspec/profile.rb +++ b/lib/inspec/profile.rb @@ -115,6 +115,9 @@ module Inspec @runner_context = options[:profile_context] || Inspec::ProfileContext.for_profile(self, @backend, @attr_values) + + @supports_platform = metadata.supports_platform?(@backend) + @supports_runtime = metadata.supports_runtime? end def name diff --git a/lib/inspec/profile_context.rb b/lib/inspec/profile_context.rb index cfc681a10..0a4c7a06d 100644 --- a/lib/inspec/profile_context.rb +++ b/lib/inspec/profile_context.rb @@ -38,6 +38,7 @@ module Inspec # in the transitive dependency tree of the loaded profile. @resource_registry = Inspec::Resource.new_registry @library_eval_context = Inspec::LibraryEvalContext.create(@resource_registry, @require_loader) + @current_load = nil end def dependencies diff --git a/lib/resources/azure/azure_virtual_machine_data_disk.rb b/lib/resources/azure/azure_virtual_machine_data_disk.rb index f879395d5..ed0959ca0 100644 --- a/lib/resources/azure/azure_virtual_machine_data_disk.rb +++ b/lib/resources/azure/azure_virtual_machine_data_disk.rb @@ -17,8 +17,6 @@ module Inspec::Resources filter = FilterTable.create filter.add_accessor(:where) .add_accessor(:entries) - .add_accessor(:has_data_disks?) - .add_accessor(:count) .add(:exists?) { |x| !x.entries.empty? } .add(:disk, field: :disk) .add(:number, field: :number) diff --git a/lib/resources/http.rb b/lib/resources/http.rb index 8c8f2e21f..d1ab89afb 100644 --- a/lib/resources/http.rb +++ b/lib/resources/http.rb @@ -74,6 +74,7 @@ module Inspec::Resources @http_method = http_method @url = url @opts = opts + @response = nil end private @@ -152,6 +153,7 @@ module Inspec::Resources 'curl is not available on the target machine' end + @ran_curl = false @inspec = inspec super(http_method, url, opts) end diff --git a/lib/resources/nginx.rb b/lib/resources/nginx.rb index 1c9ce3818..96a393563 100644 --- a/lib/resources/nginx.rb +++ b/lib/resources/nginx.rb @@ -34,7 +34,7 @@ module Inspec::Resources read_content end - %w{compiler_info error_log_path http_client_body_temp_path http_fastcgi_temp_path http_log_path http_proxy_temp_path http_scgi_temp_path http_uwsgi_temp_path lock_path modules_path openssl_version prefix sbin_path service support_info version}.each do |property| + %w{error_log_path http_client_body_temp_path http_fastcgi_temp_path http_log_path http_proxy_temp_path http_scgi_temp_path http_uwsgi_temp_path lock_path modules_path prefix sbin_path service version}.each do |property| define_method(property.to_sym) do @params[property.to_sym] end diff --git a/lib/resources/os_env.rb b/lib/resources/os_env.rb index f3ddcb716..df7cee4a8 100644 --- a/lib/resources/os_env.rb +++ b/lib/resources/os_env.rb @@ -22,7 +22,6 @@ module Inspec::Resources end " - attr_reader :content def initialize(env = nil) @osenv = env end diff --git a/lib/utils/filter.rb b/lib/utils/filter.rb index 04c18aeeb..c5a307d34 100644 --- a/lib/utils/filter.rb +++ b/lib/utils/filter.rb @@ -180,6 +180,7 @@ module FilterTable def initialize @accessors = [] @connectors = {} + @resource = nil end def connect(resource, table_accessor) # rubocop:disable Metrics/AbcSize diff --git a/test/unit/reporters/cli_test.rb b/test/unit/reporters/cli_test.rb index b996c4d0c..c9b9d207c 100644 --- a/test/unit/reporters/cli_test.rb +++ b/test/unit/reporters/cli_test.rb @@ -230,7 +230,7 @@ describe Inspec::Reporters::CLI do it 'confirm controls' do result = report.send(:anonymous_controls_from_profile, profile) result.count.must_equal 3 - result.first[:id].must_match /generated/ + result.first[:id].must_match(/generated/) end end diff --git a/test/unit/resources/aws_s3_bucket_test.rb b/test/unit/resources/aws_s3_bucket_test.rb index e3e3ea86c..227728b32 100644 --- a/test/unit/resources/aws_s3_bucket_test.rb +++ b/test/unit/resources/aws_s3_bucket_test.rb @@ -29,14 +29,14 @@ class AwsS3BucketConstructor < Minitest::Test end end -#=============================================================================# -# Search / Recall -#=============================================================================# class AwsS3BucketPropertiesTest < Minitest::Test def setup AwsS3Bucket::BackendFactory.select(AwsMSBSB::Basic) end + #===========================================================================# + # Search / Recall + #===========================================================================# def test_recall_no_match_is_no_exception refute AwsS3Bucket.new('NonExistentBucket').exists? end @@ -46,17 +46,10 @@ class AwsS3BucketPropertiesTest < Minitest::Test end # No need to handle multiple hits; S3 bucket names are globally unique. -end - -#=============================================================================# -# Properties -#=============================================================================# - -class AwsS3BucketPropertiesTest < Minitest::Test - def setup - AwsS3Bucket::BackendFactory.select(AwsMSBSB::Basic) - end + #===========================================================================# + # Properties + #===========================================================================# #---------------------Bucket Name----------------------------# def test_property_bucket_name assert_equal('public', AwsS3Bucket.new('public').bucket_name) @@ -143,17 +136,9 @@ class AwsS3BucketPropertiesTest < Minitest::Test assert_empty(bucket_policy) end -end - -#=============================================================================# -# Test Matchers -#=============================================================================# - -class AwsS3BucketPropertiesTest < Minitest::Test - def setup - AwsS3Bucket::BackendFactory.select(AwsMSBSB::Basic) - end - + #===========================================================================# + # Test Matchers + #===========================================================================# def test_be_public_public_acl assert(AwsS3Bucket.new('public').public?) end @@ -163,9 +148,6 @@ class AwsS3BucketPropertiesTest < Minitest::Test def test_be_public_private_acl refute(AwsS3Bucket.new('private').public?) end - def test_be_public_public_acl - assert(AwsS3Bucket.new('public').public?) - end def test_has_access_logging_enabled_positive assert(AwsS3Bucket.new('public').has_access_logging_enabled?)