Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created May 28, 2016 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e8219c4b13048852da2e1ba58cce941b to your computer and use it in GitHub Desktop.
Save anonymous/e8219c4b13048852da2e1ba58cce941b to your computer and use it in GitHub Desktop.
Failures:
1) Recipe Chocolate Search
Failure/Error: subject{ Recipe.for("chocolate") }
WebMock::NetConnectNotAllowedError:
Real HTTP connections are disabled. Unregistered request: GET http://food2fork.com/api?fields=key&key=eb7cd567c9dfb90c8d4da5f8a7309b41&q=search&query=chocolate with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}
You can stub this request with the following snippet:
stub_request(:get, "http://food2fork.com/api?fields=key&key=eb7cd567c9dfb90c8d4da5f8a7309b41&q=search&query=chocolate").
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,i entity;q=0.3', 'User-Agent'=>'Ruby'}).
to_return(:status => 200, :body => "", :headers => {})
registered request stubs:
stub_request(:get, "http://food2fork.com/api/search?fields=key&key=eb7cd567c9dfb90c8d4da5f8a7309b41&q=chocolate")
============================================================
# /usr/local/rvm/gems/ruby-2.3.0/gems/webmock-2.0.3/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
# /usr/local/rvm/gems/ruby-2.3.0/gems/httparty-0.13.7/lib/httparty/request.rb:117:in `perform'
# /usr/local/rvm/gems/ruby-2.3.0/gems/httparty-0.13.7/lib/httparty.rb:545:in `perform_request'
# /usr/local/rvm/gems/ruby-2.3.0/gems/httparty-0.13.7/lib/httparty.rb:476:in `get'
# ./module3_1_assignment.rb:16:in `for'
# ./spec/recipe_spec.rb:37:in `block (3 levels) in <top (required)>'
# ./spec/recipe_spec.rb:39:in `block (3 levels) in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment