26 Oct '13, 6am

How To Stub External Services In Tests

$ rspec spec/features/external_request_spec.rb F Failures: 1) External request queries FactoryGirl contributors on Github Failure/Error: response = Net::HTTP.get(uri) WebMock::NetConnectNotAllowedError: Real HTTP connections are disabled. Unregistered request: GET https://api.github.com/repos/thoughtbot/factory_girl/contributors with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'api.github.com', 'User-Agent'=>'Ruby'} You can stub this request with the following snippet: stub_request(:get, "https://api.github.com/repos/thoughtbot/factory_girl/contributors"). with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'api.github.com', 'User-Agent'=>'Ruby'}). to_return(:status => 200, :body => "", :headers => {}) ============================================================ # ./spe...

Full article: http://robots.thoughtbot.com/how-to-stub-external-service...

Tweets

How to stub external services in tests

robots.thoughtbot.com 19 Oct '13, 2pm

$ rspec spec/features/external_request_spec.rb F Failures: 1) External request queries FactoryGirl contributors on Github ...

Requests to external services during tes...

rubyflow.com 31 Oct '13, 6pm

Requests to external services during test runs can cause several issues: * Tests failing intermittently due to connectivit...

How To Stub External Services In Tests #rails

robots.thoughtbot.com 01 Nov '13, 4pm

$ rspec spec/features/external_request_spec.rb F Failures: 1) External request queries FactoryGirl contributors on Github ...

Using WebMock gem in tests and web application ...

rubyflow.com 27 Oct '13, 12am

Using WebMock gem in tests and web application services Posted by shvets on October 27, 2013 — 0 comments You can us WebMo...

Stub External Request (and even build your own ...

robots.thoughtbot.com 02 Nov '13, 3am

$ rspec spec/features/external_request_spec.rb F Failures: 1) External request queries FactoryGirl contributors on Github ...

Make your tests more resilient through internat...

robots.thoughtbot.com 26 Oct '13, 2pm

Better Tests Through Internationalization Derek Prior October 26, 2013 rails TDD Internationalization (i18n) is the proces...

Ang Hin Kee – Don’t blame external factors…

mysingaporenews.blogspot.com 26 Oct '13, 10am

AHK: " I have been to crowded places and seen how people accommodate one another. You have a choice. Don’t blame external ...

Better Tests Through Internationalization

rubyflow.com 30 Oct '13, 7pm

Better Tests Through Internationalization Posted by croaky on October 30, 2013 — 0 comments Internationalization (i18n) is...