Permalink
Browse files

Fixes failing specs due to wrong mocking

  • Loading branch information...
1 parent e5f8a22 commit 143dafeb3b5ce051df8923214842534605d8c844 @benedikt benedikt committed Sep 10, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 spec/pling/c2dm/gateway_spec.rb
@@ -164,14 +164,16 @@
end
it 'should raise a Pling::DeliveryFailed exception if the delivery was not successful' do
- connection_mock.should_receive(:post).and_return(push_response_mock)
+ connection_mock.should_receive(:post).with('https://android.apis.google.com/c2dm/send', anything, anything).
+and_return(push_response_mock)
push_response_mock.stub(:status => 401, :success? => false, :body => "Something went wrong")
expect { subject.deliver(message, device) }.to raise_error Pling::DeliveryFailed, /Something went wrong/
end
it 'should raise a Pling::DeliveryFailed exception if the response body contained an error' do
- connection_mock.should_receive(:post).and_return(push_response_mock)
+ connection_mock.should_receive(:post).with('https://android.apis.google.com/c2dm/send', anything, anything).
+and_return(push_response_mock)
push_response_mock.stub(:status => 200, :success? => true, :body => "Error=SomeError")
expect { subject.deliver(message, device) }.to raise_error Pling::DeliveryFailed, /Error=SomeError/

0 comments on commit 143dafe

Please sign in to comment.