Created
July 24, 2012 19:13
-
-
Save schoblaska/3171990 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/spec/urbanairship_spec.rb b/spec/urbanairship_spec.rb | |
| index 224591e..2fa550f 100644 | |
| --- a/spec/urbanairship_spec.rb | |
| +++ b/spec/urbanairship_spec.rb | |
| @@ -454,9 +454,12 @@ describe Urbanairship do | |
| end | |
| it "does not attempt to log if logger is not set" do | |
| + Urbanairship::Timer.should_receive(:timeout).with(5.0).and_raise(Timeout::Error) | |
| Urbanairship.logger = nil | |
| - @logger.should_not_receive(:error).with(/Urbanairship request timed out/) | |
| - Urbanairship.register_device('new_device_token') | |
| + | |
| + lambda { | |
| + Urbanairship.register_device('new_device_token') | |
| + }.should_not raise_exception(NoMethodError) | |
| end | |
| it "uses a default request_timeout value of five seconds" do |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the original test, the
should_not_receiveexpectation was placed on the mock logger, butUrbanairship.loggerwas set tonil, so the mock would have never received any method calls in the code anyway. Also, without stubbingUrbanairship::Timer.timeout, no timeout error was being raised and the code path that involved the change being tested was never run.