spec/beaker/shared/host_manager_spec.rb in beaker-4.38.1 vs spec/beaker/shared/host_manager_spec.rb in beaker-4.39.0

- old
+ new

@@ -8,11 +8,11 @@ config.patch_marshal_to_support_partial_doubles = true describe HostManager do # The logger double as nil object doesn't work with marshal.load and marshal.unload needed for run_in_parallel. let( :logger ) { double('logger') } - let( :host_handler ) { Beaker::Shared::HostManager } + let( :host_handler ) { described_class } let( :spec_block ) { Proc.new { |arr| arr } } let( :platform ) { @platform || 'unix' } let( :role0 ) { "role0" } let( :role1 ) { :role1 } let( :role2 ) { :role2 } @@ -20,11 +20,11 @@ hosts[0][:roles] = ['agent', role0] hosts[1][:roles] = ['master', 'dashboard', 'agent', 'database', role1] hosts[2][:roles] = ['agent', role2] hosts } - context "#hosts_with_name" do + describe "#hosts_with_name" do it "can identify the host by name" do expect( host_handler.hosts_with_name( hosts, 'vm1' )).to be === [hosts[0]] @@ -57,11 +57,11 @@ end - context "#hosts_with_role" do + describe "#hosts_with_role" do it "can find the master in a set of hosts" do expect( host_handler.hosts_with_role( hosts, 'master' ) ).to be === [hosts[1]] end @@ -78,11 +78,11 @@ end end - context "#only_host_with_role" do + describe "#only_host_with_role" do it "can find the single master in a set of hosts" do expect( host_handler.only_host_with_role( hosts, 'master' ) ).to be === hosts[1] end @@ -102,11 +102,11 @@ it "throws an error when role = nil" do expect{ host_handler.find_at_most_one_host_with_role( hosts, nil ) }.to raise_error(ArgumentError) end end - context "#find_at_most_one_host_with_role" do + describe "#find_at_most_one_host_with_role" do it "can find the single master in a set of hosts" do expect( host_handler.find_at_most_one_host_with_role( hosts, 'master' ) ).to be === hosts[1] end @@ -126,11 +126,11 @@ it "throws an error when role = nil" do expect{ host_handler.find_at_most_one_host_with_role( hosts, nil ) }.to raise_error(ArgumentError) end end - context "#run_block_on" do + describe "#run_block_on" do it "can execute a block against hosts identified by a string" do myhosts = host_handler.run_block_on( hosts, role0 ) do |hosts| hosts end expect( myhosts ).to be === hosts[0] @@ -163,10 +163,10 @@ host end # After marshal load and marshal unload, the logger option (an rspec double) is no longer 'equal' to the original. # Array of results can be in different order. - new_host = myhosts.select{ |host| host.name == hosts[0].name}.first + new_host = myhosts.find{ |host| host.name == hosts[0].name} hosts[0].options.each { |option| expect(option[1]).to eq(new_host.options[option[0]]) unless option[0] == :logger } end