Skip to content

Commit

Permalink
Use "cwm/rspec" shared examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Oct 26, 2018
1 parent b94233a commit aab67b0
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 36 deletions.
2 changes: 0 additions & 2 deletions src/lib/y2caasp/clients/admin_role_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def initialize
super
end

private

def title
_("Admin Node Configuration")
end
Expand Down
2 changes: 0 additions & 2 deletions src/lib/y2caasp/clients/worker_role_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ def initialize
super
end

private

def title
_("Cluster Node Configuration")
end
Expand Down
4 changes: 2 additions & 2 deletions test/lib/y2caasp/clients/admin_role_dialog_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

require_relative "../../../test_helper.rb"
require_relative "role_dialog_examples"
require "cwm/rspec"

require "y2caasp/clients/admin_role_dialog.rb"

Yast.import "CWM"
Yast.import "Lan"
Yast.import "Mode"
Yast.import "Wizard"

describe ::Y2Caasp::AdminRoleDialog do
Expand All @@ -22,7 +22,7 @@
allow(Yast::LanItems).to receive(:dhcp_ntp_servers).and_return({})
end

include_examples "displays the dialog"
include_examples "CWM::Dialog"
include_examples "NTP from DHCP"
end
end
26 changes: 0 additions & 26 deletions test/lib/y2caasp/clients/role_dialog_examples.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,4 @@

shared_examples "displays the dialog" do
it "creates wizard dialog in normal mode" do
allow(Yast::Mode).to receive(:normal).and_return(true)

expect(Yast::Wizard).to receive(:CreateDialog)

subject.run
end

it "closed wizard dialog in normal mode" do
allow(Yast::Mode).to receive(:normal).and_return(true)

expect(Yast::Wizard).to receive(:CloseDialog)

subject.run
end

it "shows CWM widgets" do
allow(Yast::Mode).to receive(:normal).and_return(true)

expect(Yast::CWM).to receive(:show).and_return(:next)

subject.run
end
end

shared_examples "NTP from DHCP" do
context "when some NTP server is detected via DHCP" do
let(:ntp_servers) { ["ntp.example.com"] }
Expand Down
6 changes: 2 additions & 4 deletions test/lib/y2caasp/clients/worker_role_dialog_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

require_relative "../../../test_helper.rb"
require_relative "role_dialog_examples"
require "cwm/rspec"

require "y2caasp/clients/worker_role_dialog.rb"

Yast.import "CWM"
Yast.import "Lan"
Yast.import "Mode"
Yast.import "Wizard"

describe ::Y2Caasp::WorkerRoleDialog do
describe "#run" do
let(:ntp_servers) { [] }

before do
allow(Yast::Wizard).to receive(:CreateDialog)
allow(Yast::Wizard).to receive(:CloseDialog)
Expand All @@ -22,7 +20,7 @@
allow(Yast::LanItems).to receive(:dhcp_ntp_servers).and_return({})
end

include_examples "displays the dialog"
include_examples "CWM::Dialog"
include_examples "NTP from DHCP"
end
end

0 comments on commit aab67b0

Please sign in to comment.