spec/google/compute/zone_operation_spec.rb in knife-google-1.1.0 vs spec/google/compute/zone_operation_spec.rb in knife-google-1.2.0

- old
+ new

@@ -14,36 +14,36 @@ require 'spec_helper' describe Google::Compute::ZoneOperation do before(:each) do - @mock_api_client=mock(Google::APIClient, :authorization= =>{}, :auto_refresh_token= =>{}) - @mock_api_client.stub!(:discovered_api).and_return(mock_compute) - Google::APIClient.stub!(:new).and_return(@mock_api_client) + @mock_api_client=double(Google::APIClient, :authorization= => {}, :auto_refresh_token= => {}) + @mock_api_client.stub(:discovered_api).and_return(mock_compute) + Google::APIClient.stub(:new).and_return(@mock_api_client) end let(:client) do Google::Compute::Client.from_json(mock_data_file(Google::Compute::Client)) end it_should_behave_like Google::Compute::Resource it '#list should return an array of zone operations' do @mock_api_client.should_receive(:execute). - with(:api_method=>mock_compute.zone_operations.list, - :parameters=>{ :project=>'mock-project'},:body_object=>nil). + with(:api_method => mock_compute.zone_operations.list, + :parameters => { :project => 'mock-project'}, :body_object => nil). and_return(mock_response(Google::Compute::ZoneOperation, true)) operations = client.zoneOperations.list operations.should_not be_empty operations.all?{|o| o.is_a?(Google::Compute::ZoneOperation)}.should be_true end it '#get should return an individual zone operation' do @mock_api_client.should_receive(:execute). - with(:api_method=>mock_compute.zone_operations.get, - :parameters=>{'zoneOperation'=>'mock-zone-operation', :project=>'mock-project'},:body_object=>nil). + with(:api_method => mock_compute.zone_operations.get, + :parameters => {'zoneOperation' => 'mock-zone-operation', :project => 'mock-project'}, :body_object => nil). and_return(mock_response(Google::Compute::ZoneOperation)) operation = client.zoneOperations.get('mock-zone-operation') operation.should be_a_kind_of Google::Compute::ZoneOperation operation.name.should eq('mock-zone-operation') @@ -51,11 +51,11 @@ operation.start_time.should be_a_kind_of(Time) end it '#delete should delete an existing zone operation' do @mock_api_client.should_receive(:execute). - with(:api_method=>mock_compute.zone_operations.delete, - :parameters=>{'zoneOperation'=>'mock-zone-operation', :project=>'mock-project'},:body_object=>nil). + with(:api_method => mock_compute.zone_operations.delete, + :parameters => {'zoneOperation' => 'mock-zone-operation', :project => 'mock-project'}, :body_object => nil). and_return(mock_response) client.zoneOperations.delete('mock-zone-operation') end end