Skip to content

Commit

Permalink
fix rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 20, 2015
1 parent bb4cef9 commit 579f59e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion library/general/src/lib/ui/dialog.rb
Expand Up @@ -26,7 +26,7 @@ module UI
#
# # run dialog
# OKDialog.run

#
class Dialog
# we want event dispatching in dialog
include EventDispatcher
Expand Down
12 changes: 8 additions & 4 deletions library/general/test/dialog_test.rb
Expand Up @@ -52,23 +52,27 @@ def mock_ui_events(*events)
it "raise exception if dialog opening failed" do
allow(Yast::UI).to receive(:OpenDialog).and_return(false)

expect{subject.run}.to raise_error
expect { subject.run }.to raise_error
end

it "ensure dialog is closed even if exception is raised in event loop" do
mock_ui_events(:ok)
expect(Yast::UI).to receive(:CloseDialog)

subject.run rescue "expected"
begin
subject.run
rescue
"expected"
end
end

it "raise NoMethodError if abstract method dialog_content is not implemented" do
expect{UI::Dialog.run}.to raise_error(NoMethodError)
expect { UI::Dialog.run }.to raise_error(NoMethodError)
end

it "pass dialog options if defined" do
expect(Yast::UI).to receive(:OpenDialog).and_return(true)
.with(Yast::Term.new(:opt, :defaultsize), anything())
.with(Yast::Term.new(:opt, :defaultsize), anything)

TestDialog2.run
end
Expand Down

0 comments on commit 579f59e

Please sign in to comment.