-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for finish_client and also fix founded bugs
- Loading branch information
1 parent
4810296
commit 808060f
Showing
3 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
TESTS = \ | ||
asciifile_test.rb \ | ||
finish_client_test.rb \ | ||
hooks_test.rb \ | ||
linuxrc_test.rb \ | ||
os_release_test.rb \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
require_relative "test_helper" | ||
|
||
require "installation/finish_client" | ||
|
||
class TestFinish < ::Installation::FinishClient | ||
def info | ||
"info" | ||
end | ||
|
||
def write | ||
"write" | ||
end | ||
end | ||
|
||
describe ::Installation::FinishClient do | ||
subject { ::TestFinish } | ||
describe ".run" do | ||
it "raise exception if unknown first argument is passed" do | ||
allow(Yast::WFM).to receive(:Args).and_return(["Unknown", {}]) | ||
expect{::Installation::ProposalClient.run}.to raise_error | ||
end | ||
|
||
context "first client argument is Info" do | ||
before do | ||
allow(Yast::WFM).to receive(:Args).and_return(["Info"]) | ||
end | ||
|
||
it "dispatch call to abstract method info" do | ||
expect(subject.run).to eq "info" | ||
end | ||
|
||
it "raise NotImplementedError exception if abstract method not defined" do | ||
expect{::Installation::FinishClient.run}.to raise_error(NotImplementedError) | ||
end | ||
end | ||
|
||
context "first client argument is Write" do | ||
before do | ||
allow(Yast::WFM).to receive(:Args).and_return(["Write"]) | ||
end | ||
|
||
it "dispatch call to abstract method write" do | ||
expect(subject.run).to eq "write" | ||
end | ||
|
||
it "raise NotImplementedError exception if abstract method not defined" do | ||
expect{::Installation::FinishClient.run}.to raise_error(NotImplementedError) | ||
end | ||
end | ||
end | ||
end |