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

- old
+ new

@@ -15,34 +15,34 @@ require 'spec_helper' describe Google::Compute::Zone 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 '#get should return an individual zone' do @mock_api_client.should_receive(:execute). - with(:api_method=>mock_compute.zones.get, - :parameters=>{'zone'=>'mock-zone', :project=>'mock-project'},:body_object=>nil). + with(:api_method => mock_compute.zones.get, + :parameters => {'zone' => 'mock-zone', :project => 'mock-project'}, :body_object => nil). and_return(mock_response(Google::Compute::Zone)) zone = client.zones.get('mock-zone') zone.should be_a_kind_of Google::Compute::Zone zone.name.should eq('mock-zone') end it '#list should return an array of zones' do @mock_api_client.should_receive(:execute). - with(:api_method=>mock_compute.zones.list, - :parameters=>{ :project=>'mock-project'},:body_object=>nil). + with(:api_method => mock_compute.zones.list, + :parameters => { :project => 'mock-project'}, :body_object => nil). and_return(mock_response(Google::Compute::Zone, true)) zones = client.zones.list zones.should_not be_empty zones.all?{|zone| zone.is_a?(Google::Compute::Zone)}.should be_true end