New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bsc#1036440: Warning messages shouldn't open UI in command-line mode #580
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, but I am missing some test cases. Please, check report_test.rb and try to add some test cases.
library/general/test/report_test.rb
Outdated
it "prints the message only on console" do | ||
expect(Yast::CommandLine).to receive("Print") | ||
.with(/#{message}/) | ||
expect(Yast::Popup).to_not receive("Warning") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for consistence, I would use :Warning
symbol instead of the string.
library/general/test/report_test.rb
Outdated
|
||
before(:each) do | ||
subject.DisplayWarnings(show, timeout) | ||
allow(Yast::Mode).to receive(:commandline).and_return(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are going to mock Yast::Mode.commandline
in all cases, maybe you would like to move it to a before block and just define the value for each case.
before do
allow(Yast::Mode).to receive(:commandline).and_return(commandline?)
end
context "while in UI mode and timeout is disabled" do
let(:timeout) { 0 }
let(:commandline?) { false }
it "shows a popup" do
#...
end
end
library/general/test/report_test.rb
Outdated
|
||
context "while in command-line mode" do | ||
before(:each) do | ||
allow(Yast::Mode).to receive(:commandline).and_return(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same than above. I would move this line to the outer before block.
package/yast2.changes
Outdated
@@ -1,4 +1,11 @@ | |||
------------------------------------------------------------------- | |||
Mon May 29 08:19:46 UTC 2017 - gsouza@suse.com | |||
|
|||
- bsc#1036440: Warning messages shouldn't open UI in command-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually write it like this:
- Warning messages shouldn't open UI in command-line mode (bsc#1036440)
Thanks for these tests! |
No description provided.