spec/beaker/dsl/helpers/host_helpers_spec.rb in beaker-4.38.1 vs spec/beaker/dsl/helpers/host_helpers_spec.rb in beaker-4.39.0
- old
+ new
@@ -25,11 +25,11 @@
let( :db ) { make_host( 'db', :roles => %w( database agent ) ) }
let( :hosts ) { [ master, agent, dash, db, custom ] }
describe '#on' do
- before :each do
+ before do
result.stdout = 'stdout'
result.stderr = 'stderr'
result.exit_code = 0
end
@@ -104,11 +104,11 @@
results = subject.on( hosts, command )
expect( results ).to be == expected
end
context 'upon command completion' do
- before :each do
+ before do
allow( subject ).to receive( :hosts ).and_return( hosts )
expect( host ).to receive( :exec ).and_return( result )
@res = subject.on( host, command )
end
@@ -128,11 +128,11 @@
expect( @res.exit_code ).to be == 0
end
end
context 'when passed a block with arity of 1' do
- before :each do
+ before do
allow( subject ).to receive( :hosts ).and_return( hosts )
expect( host ).to receive( :exec ).and_return( result )
end
it 'yields result' do
@@ -160,19 +160,19 @@
end
end
end
context 'when passed a block with arity of 0' do
- before :each do
+ before do
allow( subject ).to receive( :hosts ).and_return( hosts )
expect( host ).to receive( :exec ).and_return( result )
end
it 'yields self' do
subject.on host, command do
expect( subject ).
- to be_an_instance_of( ClassMixedWithDSLHelpers )
+ to be_an_instance_of( described_class )
end
end
it 'provides access to stdout' do
subject.on host, command do
@@ -317,11 +317,11 @@
describe '#create_remote_file using scp' do
it 'scps the contents passed in to the hosts' do
my_opts = { :silent => true }
tmpfile = double
- expect( tmpfile ).to receive( :path ).exactly( 2 ).times.
+ expect( tmpfile ).to receive( :path ).twice.
and_return( '/local/path/to/blah' )
expect( Tempfile ).to receive( :open ).and_yield( tmpfile )
expect( File ).to receive( :open )
@@ -336,10 +336,10 @@
describe '#create_remote_file using rsync' do
it 'scps the contents passed in to the hosts' do
my_opts = { :silent => true, :protocol => 'rsync' }
tmpfile = double
- expect( tmpfile ).to receive( :path ).exactly( 2 ).times.
+ expect( tmpfile ).to receive( :path ).twice.
and_return( '/local/path/to/blah' )
expect( Tempfile ).to receive( :open ).and_yield( tmpfile )
expect( File ).to receive( :open )