summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-08-07 21:17:16 -0700
committerGitHub <noreply@github.com>2020-08-07 21:17:16 -0700
commit29029126ddbb9d823552e95215e719d153071bee (patch)
treea6687a1c24bb66059048cc6f16a326448c42930c /spec
parentfe4ef169d73daf68ccfd152530ecd359eaa0ee6b (diff)
parentab6180be02712512a3a8309e75424dc56520b936 (diff)
downloadohai-29029126ddbb9d823552e95215e719d153071bee.tar.gz
Merge pull request #1489 from chef/fix_fips
Simplify FIPS plugin and use system fips status
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/plugins/fips_spec.rb29
1 files changed, 8 insertions, 21 deletions
diff --git a/spec/unit/plugins/fips_spec.rb b/spec/unit/plugins/fips_spec.rb
index c91ef5b2..ff9aa75d 100644
--- a/spec/unit/plugins/fips_spec.rb
+++ b/spec/unit/plugins/fips_spec.rb
@@ -25,36 +25,23 @@ describe Ohai::System, "plugin fips" do
plugin["fips"]["kernel"]["enabled"]
end
- let(:enabled) { 0 }
let(:plugin) { get_plugin("fips") }
- let(:openssl_test_mode) { false }
before do
allow(plugin).to receive(:collect_os).and_return(:linux)
end
- around do |ex|
-
- $FIPS_TEST_MODE = openssl_test_mode
- ex.run
- ensure
- $FIPS_TEST_MODE = false
-
- end
-
- context "with OpenSSL.fips_mode == false" do
- before { allow(OpenSSL).to receive(:fips_mode).and_return(false) }
-
- it "does not set fips plugin" do
- expect(subject).to be(false)
+ context "when OpenSSL reports FIPS mode true" do
+ it "sets fips enabled true" do
+ stub_const("OpenSSL::OPENSSL_FIPS", true)
+ expect(subject).to be(true)
end
end
- context "with OpenSSL.fips_mode == true" do
- before { allow(OpenSSL).to receive(:fips_mode).and_return(true) }
-
- it "sets fips plugin" do
- expect(subject).to be(true)
+ context "when OpenSSL reports FIPS mode false" do
+ it "sets fips enabled false" do
+ stub_const("OpenSSL::OPENSSL_FIPS", false)
+ expect(subject).to be(false)
end
end
end