{"id":982,"date":"2022-08-30T15:10:25","date_gmt":"2022-08-30T15:10:25","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/how-do-you-setup-a-request-object-for-integration-tests-in-capybara-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:10:25","modified_gmt":"2022-08-30T15:10:25","slug":"how-do-you-setup-a-request-object-for-integration-tests-in-capybara-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-do-you-setup-a-request-object-for-integration-tests-in-capybara-collection-of-common-programming-errors\/","title":{"rendered":"How do you setup a request object for integration tests in Capybara?-Collection of common programming errors"},"content":{"rendered":"<p><code>request<\/code> is not available in capybara but I am trying to test login via facebook\/twitter. How do I create a helper to be able to use <code>request<\/code>?<\/p>\n<p>Error: <code>NameError: undefined local variable or method 'request'<\/code><\/p>\n<p>login_integration_tests.rb:<\/p>\n<pre><code>  before do\n    OmniAuth.config.mock_auth[:facebook] = {\n      'provider' =&gt; 'facebook',\n      'uid' =&gt; '123545'\n    }\n    request.env[\"omniauth.auth\"] = OmniAuth.config.mock_auth[:facebook] # error here\n  end\n<\/code><\/pre>\n<p>Thanks for your help!<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:10:38. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>request is not available in capybara but I am trying to test login via facebook\/twitter. How do I create a helper to be able to use request? Error: NameError: undefined local variable or method &#8216;request&#8217; login_integration_tests.rb: before do OmniAuth.config.mock_auth[:facebook] = { &#8216;provider&#8217; =&gt; &#8216;facebook&#8217;, &#8216;uid&#8217; =&gt; &#8216;123545&#8217; } request.env[&#8220;omniauth.auth&#8221;] = OmniAuth.config.mock_auth[:facebook] # error here end [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,1],"tags":[],"class_list":["post-982","post","type-post","status-publish","format-standard","hentry","category-capybara","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=982"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/982\/revisions"}],"predecessor-version":[{"id":8746,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/982\/revisions\/8746"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}