Mitigate trivial warning output on test (#2872)

* Mitigate trivial warning on test by initializing
Also fixes passing a ambiguous argument.
* Mitigate trivial warning by removing redundant method

Signed-off-by: ERAMOTO Masaya <eramoto.masaya@jp.fujitsu.com>
This commit is contained in:
eramoto 2018-03-29 00:22:01 +09:00 committed by Jared Quick
parent a5ff79d308
commit 53a53820cf
10 changed files with 19 additions and 32 deletions

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -22,7 +22,6 @@ module Inspec::Resources
end
"
attr_reader :content
def initialize(env = nil)
@osenv = env
end

View file

@ -180,6 +180,7 @@ module FilterTable
def initialize
@accessors = []
@connectors = {}
@resource = nil
end
def connect(resource, table_accessor) # rubocop:disable Metrics/AbcSize

View file

@ -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

View file

@ -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
#===========================================================================#
#---------------------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
#===========================================================================#
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?)