mirror of
https://github.com/inspec/inspec
synced 2024-11-10 23:24:18 +00:00
PR feedback part 1
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
76a9c3e590
commit
357cf051b1
3 changed files with 10 additions and 10 deletions
|
@ -9,7 +9,7 @@ module Inspec
|
|||
end
|
||||
|
||||
def self.src_root
|
||||
@src_root ||= File.expand_path(File.join(__FILE__, "..", "..", ".."))
|
||||
@src_root ||= File.expand_path(File.join(__FILE__, "../../.."))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Inspec
|
||||
|
||||
# Hueristics to determine how InSpec was installed.
|
||||
# Heuristics to determine how InSpec was installed.
|
||||
module InstallContextHelpers
|
||||
|
||||
def guess_install_context
|
||||
|
|
|
@ -2,17 +2,17 @@ require "helper"
|
|||
require "inspec/globals"
|
||||
require "inspec/utils/install_context"
|
||||
|
||||
def check_install_contexts(test_expected_to_be_true, also_rubygem)
|
||||
def assert_install_contexts(test_expected_to_be_true, also_rubygem)
|
||||
should_be_false = %w{chef-workstation chefdk docker
|
||||
habitat omnibus rubygem source}
|
||||
should_be_false -= [test_expected_to_be_true]
|
||||
should_be_false = should_be_false.map { |m| "#{m}_install?".tr("-", "_").to_sym }
|
||||
should_be_false -= [:rubygem_install?] if also_rubygem
|
||||
should_be_false.each { |m| expect(Inspec.method(m).call).must_equal false }
|
||||
should_be_false.each { |m| expect(Inspec.send(m)).must_equal false }
|
||||
|
||||
should_be_true = ["#{test_expected_to_be_true}_install?".tr("-", "_").to_sym]
|
||||
should_be_true += [:rubygem_install?] if also_rubygem
|
||||
should_be_true.each { |m| expect(Inspec.method(m).call).must_equal true }
|
||||
should_be_true.each { |m| expect(Inspec.send(m)).must_equal true }
|
||||
|
||||
expect(Inspec.guess_install_context).must_equal test_expected_to_be_true
|
||||
end
|
||||
|
@ -25,7 +25,7 @@ describe Inspec::InstallContextHelpers do
|
|||
end
|
||||
|
||||
it "should properly detect a Docker install" do
|
||||
check_install_contexts("docker", true)
|
||||
assert_install_contexts("docker", true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ describe Inspec::InstallContextHelpers do
|
|||
end
|
||||
|
||||
it "should properly detect a habitat install" do
|
||||
check_install_contexts("habitat", true)
|
||||
assert_install_contexts("habitat", true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -45,7 +45,7 @@ describe Inspec::InstallContextHelpers do
|
|||
end
|
||||
|
||||
it "should properly detect a rubygem install" do
|
||||
check_install_contexts("rubygem", true)
|
||||
assert_install_contexts("rubygem", true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -58,7 +58,7 @@ describe Inspec::InstallContextHelpers do
|
|||
end
|
||||
|
||||
it "should properly detect a source install" do
|
||||
check_install_contexts("source", false)
|
||||
assert_install_contexts("source", false)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -77,7 +77,7 @@ describe Inspec::InstallContextHelpers do
|
|||
Inspec.expects(:src_root).at_least_once.returns("#{inst_dir}/#{inst_subdir}/embedded/lib/ruby/gems/2.6.0/gems/inspec-4.18.39")
|
||||
end
|
||||
it "should properly detect a #{os_name} #{inst_mode} install" do
|
||||
check_install_contexts(inst_mode, true)
|
||||
assert_install_contexts(inst_mode, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue