01 Nov '13, 4pm

How To Stub External Services In Tests #rails

$ 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

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 ...

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

robots.thoughtbot.com 26 Oct '13, 6am

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

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...

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...

Writing Rails engine rspec controller tests #rails

pivotallabs.com 04 Nov '13, 6pm

If you are trying to test controllers under a Rails engine, you might come across this error: Failure/Error: get :index Ac...

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...

Blog- Celcom M2M Connected Services Launched

malaysianwireless.com 01 Nov '13, 6am

M2M Connected Services will be further upgraded in the near future to feature an additional M2M Gateway integrated with Ce...