spec/beaker/dsl/helpers/host_helpers_spec.rb in beaker-2.33.0 vs spec/beaker/dsl/helpers/host_helpers_spec.rb in beaker-2.34.0

- old
+ new

@@ -48,11 +48,11 @@ expect( master ).to receive( :exec ).once subject.on( 'master', 'echo hello') end - it 'if the host is a Symbol Object, finds the matching hsots with that Symbol as role' do + it 'if the host is a Symbol Object, finds the matching hosts with that Symbol as role' do allow( subject ).to receive( :hosts ).and_return( hosts ) expect( master ).to receive( :exec ).once subject.on( :master, 'echo hello') @@ -154,9 +154,21 @@ it 'provides access to exit_code' do subject.on host, command do expect( subject.exit_code ).to be == 0 end end + end + + it 'errors if command is not a String or Beaker::Command' do + expect { + subject.on( host, Object.new ) + }.to raise_error( ArgumentError, /called\ with\ a\ String\ or\ Beaker/ ) + end + + it 'executes the passed Beaker::Command if given as command argument' do + command_test = Beaker::Command.new( 'echo face_testing' ) + expect( master ).to receive( :exec ).with( command_test, anything ) + subject.on( master, command_test ) end end describe "#retry_on" do it 'fails correctly when command never succeeds' do