Skip to content

Commit

Permalink
Test case according to Imo's wishes
Browse files Browse the repository at this point in the history
  • Loading branch information
kobliha committed Jun 3, 2015
1 parent 1f985fa commit 79b42da
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions library/system/test/fs_snapshot_test.rb
Expand Up @@ -84,7 +84,7 @@ def logger

before do
allow(Yast2::FsSnapshot).to receive(:configured?).and_return(configured)
allow(Yast2::FsSnapshot).to receive(:create_snapshot?).and_return(create_snapshot)
allow(Yast2::FsSnapshot).to receive(:create_snapshot?).with(:single).and_return(create_snapshot)
end

context "when snapper is configured" do
Expand Down Expand Up @@ -146,7 +146,7 @@ def logger

before do
allow(Yast2::FsSnapshot).to receive(:configured?).and_return(configured)
allow(Yast2::FsSnapshot).to receive(:create_snapshot?).and_return(create_snapshot)
allow(Yast2::FsSnapshot).to receive(:create_snapshot?).with(:around).and_return(create_snapshot)
end

context "when snapper is configured" do
Expand Down Expand Up @@ -209,7 +209,7 @@ def logger

before do
allow(Yast2::FsSnapshot).to receive(:configured?).and_return(configured)
allow(Yast2::FsSnapshot).to receive(:create_snapshot?).and_return(create_snapshot)
allow(Yast2::FsSnapshot).to receive(:create_snapshot?).with(:around).and_return(create_snapshot)
end

context "when snapper is configured" do
Expand Down Expand Up @@ -408,7 +408,7 @@ def logger
end

context "when single value is defined on Linuxrc commandline" do
it "returns whether given snapshot is requested" do
it "returns whether given snapshot type is allowed" do
allow(Yast::Linuxrc).to receive(:get_value).with(/snapshot/).and_return("around")
expect(described_class.create_snapshot?(:around)).to eq(false)
expect(described_class.create_snapshot?(:single)).to eq(true)
Expand All @@ -424,7 +424,7 @@ def logger
end

context "when more values are defined on Linuxrc commandline" do
it "returns whether given snapshot is not withing disabled snapshots" do
it "returns whether given snapshot type is not within disabled snapshots types" do
allow(Yast::Linuxrc).to receive(:get_value).with(/snapshot/).and_return("single,around")
expect(described_class.create_snapshot?(:around)).to eq(false)
expect(described_class.create_snapshot?(:single)).to eq(false)
Expand All @@ -435,9 +435,8 @@ def logger
end
end


context "when no value is defined on Linuxrc commandline" do
it "returns that any snapshots are requested" do
it "returns that any snapshots are allowed" do
allow(Yast::Linuxrc).to receive(:get_value).with(/snapshot/).and_return(nil)
expect(described_class.create_snapshot?(:around)).to eq(true)
expect(described_class.create_snapshot?(:single)).to eq(true)
Expand All @@ -454,6 +453,5 @@ def logger
expect { described_class.create_snapshot?(:some) }.to raise_error(ArgumentError, /:some/)
end
end

end
end

0 comments on commit 79b42da

Please sign in to comment.