spec/beaker/hypervisor/vcloud_pooled_spec.rb in beaker-1.21.0 vs spec/beaker/hypervisor/vcloud_pooled_spec.rb in beaker-2.0.0

- old
+ new

@@ -5,16 +5,16 @@ before :each do vms = make_hosts() MockVsphereHelper.set_config( fog_file_contents ) MockVsphereHelper.set_vms( vms ) - stub_const( "VsphereHelper", MockVsphereHelper ) - stub_const( "Net", MockNet ) - JSON.stub( :parse ) do |arg| + stub_const( "VsphereHelper", MockVsphereHelper ) + stub_const( "Net", MockNet ) + allow( JSON ).to receive( :parse ) do |arg| arg end - Socket.stub( :getaddrinfo ).and_return( true ) + allow( Socket ).to receive( :getaddrinfo ).and_return( true ) end describe '#get_template_url' do it 'works returns the valid url when passed valid pooling_api and template name' do @@ -44,12 +44,12 @@ describe "#provision" do it 'provisions hosts from the pool' do vcloud = Beaker::VcloudPooled.new( make_hosts, make_opts ) - vcloud.stub( :require ).and_return( true ) - vcloud.stub( :sleep ).and_return( true ) + allow( vcloud ).to receive( :require ).and_return( true ) + allow( vcloud ).to receive( :sleep ).and_return( true ) vcloud.provision hosts = vcloud.instance_variable_get( :@hosts ) hosts.each do | host | expect( host['vmhostname'] ).to be === 'pool' @@ -63,11 +63,11 @@ it "cleans up hosts in the pool" do MockVsphereHelper.powerOn vcloud = Beaker::VcloudPooled.new( make_hosts, make_opts ) - vcloud.stub( :require ).and_return( true ) - vcloud.stub( :sleep ).and_return( true ) + allow( vcloud ).to receive( :require ).and_return( true ) + allow( vcloud ).to receive( :sleep ).and_return( true ) vcloud.provision vcloud.cleanup hosts = vcloud.instance_variable_get( :@hosts ) hosts.each do | host |