spec/cases/api_spec.rb in koala-1.7.0rc1 vs spec/cases/api_spec.rb in koala-1.8.0rc1

- old
+ new

@@ -37,29 +37,29 @@ end it "gets the attribute of a Koala::HTTPService::Response given by the http_component parameter" do http_component = :method_name - response = mock('Mock KoalaResponse', :body => '', :status => 200) - result = stub("result") + response = double('Mock KoalaResponse', :body => '', :status => 200) + result = double("result") response.stub(http_component).and_return(result) Koala.stub(:make_request).and_return(response) @service.api('anything', {}, 'get', :http_component => http_component).should == result end it "returns the entire response if http_component => :response" do http_component = :response - response = mock('Mock KoalaResponse', :body => '', :status => 200) + response = double('Mock KoalaResponse', :body => '', :status => 200) Koala.stub(:make_request).and_return(response) @service.api('anything', {}, 'get', :http_component => http_component).should == response end it "turns arrays of non-enumerables into comma-separated arguments" do args = [12345, {:foo => [1, 2, "3", :four]}] expected = ["/12345", {:foo => "1,2,3,four"}, "get", {}] - response = mock('Mock KoalaResponse', :body => '', :status => 200) + response = double('Mock KoalaResponse', :body => '', :status => 200) Koala.should_receive(:make_request).with(*expected).and_return(response) @service.api(*args) end it "doesn't turn arrays containing enumerables into comma-separated strings" do @@ -67,29 +67,29 @@ args = [12345, params] # we leave this as is -- the HTTP layer can either handle it appropriately # (if appropriate behavior is defined) # or raise an exception expected = ["/12345", params, "get", {}] - response = mock('Mock KoalaResponse', :body => '', :status => 200) + response = double('Mock KoalaResponse', :body => '', :status => 200) Koala.should_receive(:make_request).with(*expected).and_return(response) @service.api(*args) end it "returns the body of the request as JSON if no http_component is given" do - response = stub('response', :body => 'body', :status => 200) + response = double('response', :body => 'body', :status => 200) Koala.stub(:make_request).and_return(response) - json_body = mock('JSON body') + json_body = double('JSON body') MultiJson.stub(:load).and_return([json_body]) @service.api('anything').should == json_body end it "executes an error checking block if provided" do response = Koala::HTTPService::Response.new(200, '{}', {}) Koala.stub(:make_request).and_return(response) - yield_test = mock('Yield Tester') + yield_test = double('Yield Tester') yield_test.should_receive(:pass) @service.api('anything', {}, "get") do |arg| yield_test.pass arg.should == response