Skip to content

Commit

Permalink
updated description
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Sep 30, 2019
1 parent b961d39 commit 8c91ed2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/security_test.rb
Expand Up @@ -230,7 +230,7 @@ def enabled?
end

context "when ctrl+alt+del file not exist" do
it "returns 'reboot'" do
it "sets settings for shutdown as 'reboot'" do
allow(FileUtils).to receive(:Exists).with(ctrl_alt_del_file) { false }

Security.ReadConsoleShutdown
Expand All @@ -243,23 +243,23 @@ def enabled?
allow(FileUtils).to receive(:Exists).with(ctrl_alt_del_file) { true }
end

it "returns 'ignore' by default" do
it "sets settings for shutdown as 'ignore' by default" do
allow(SCR).to receive(:Read).with(path(".target.symlink"), ctrl_alt_del_file)
.and_return("dummy_file")

Security.ReadConsoleShutdown
expect(Security.Settings["CONSOLE_SHUTDOWN"]).to eql("ignore")
end

it "returns 'halt' if links to poweroff.target" do
it "sets settings for shutdown as 'halt' if links to poweroff.target" do
allow(SCR).to receive(:Read).with(path(".target.symlink"), ctrl_alt_del_file)
.and_return(target_link)

Security.ReadConsoleShutdown
expect(Security.Settings["CONSOLE_SHUTDOWN"]).to eql("halt")
end

it "returns 'reboot' if links to reboot.target" do
it "sets settings for shutdown as 'reboot' if links to reboot.target" do
target_link = "/usr/lib/systemd/system/reboot.target"
allow(SCR).to receive(:Read).with(path(".target.symlink"), ctrl_alt_del_file)
.and_return(target_link)
Expand All @@ -268,7 +268,7 @@ def enabled?
expect(Security.Settings["CONSOLE_SHUTDOWN"]).to eql("reboot")
end

it "returns 'reboot' if links to ctrl-alt-del.target" do
it "sets settings for shutdown as 'reboot' if links to ctrl-alt-del.target" do
target_link = "/usr/lib/systemd/system/ctrl-alt-del.target"
allow(SCR).to receive(:Read).with(path(".target.symlink"), ctrl_alt_del_file)
.and_return(target_link)
Expand All @@ -286,7 +286,7 @@ def enabled?
end

context "when ctrl+alt+del file not exist" do
it "returns 'reboot'" do
it "sets settings for shutdown as 'reboot'" do
allow(FileUtils).to receive(:Exists).with(ctrl_alt_del_file) { false }

Security.ReadConsoleShutdown
Expand All @@ -299,23 +299,23 @@ def enabled?
allow(FileUtils).to receive(:Exists).with(ctrl_alt_del_file) { true }
end

it "returns 'ignore' by default" do
it "sets settings for shutdown as 'ignore' by default" do
allow(SCR).to receive(:Read).with(path(".target.symlink"), ctrl_alt_del_file)
.and_return("dummy_file")

Security.ReadConsoleShutdown
expect(Security.Settings["CONSOLE_SHUTDOWN"]).to eql("ignore")
end

it "returns 'halt' if links to poweroff.target" do
it "sets settings for shutdown as 'halt' if links to poweroff.target" do
allow(SCR).to receive(:Read).with(path(".target.symlink"), ctrl_alt_del_file)
.and_return(target_link)

Security.ReadConsoleShutdown
expect(Security.Settings["CONSOLE_SHUTDOWN"]).to eql("halt")
end

it "returns 'reboot' if links to reboot.target" do
it "sets settings for shutdown as 'reboot' if links to reboot.target" do
target_link = "/usr/lib/systemd/system/reboot.target"
allow(SCR).to receive(:Read).with(path(".target.symlink"), ctrl_alt_del_file)
.and_return(target_link)
Expand All @@ -324,7 +324,7 @@ def enabled?
expect(Security.Settings["CONSOLE_SHUTDOWN"]).to eql("reboot")
end

it "returns 'halt' if links to ctrl-alt-del.target" do
it "sets settings for shutdown as 'halt' if links to ctrl-alt-del.target" do
target_link = "/usr/lib/systemd/system/ctrl-alt-del.target"
allow(SCR).to receive(:Read).with(path(".target.symlink"), ctrl_alt_del_file)
.and_return(target_link)
Expand All @@ -349,7 +349,7 @@ def enabled?
end

context "when no inittab ca entry" do
it "returns 'reboot'" do
it "sets settings for shutdown as 'reboot'" do
allow(FileUtils).to receive(:Exists).with("/etc/inittab") { false }

Security.ReadConsoleShutdown
Expand Down

0 comments on commit 8c91ed2

Please sign in to comment.