Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable new_google_recaptcha for test cases #12

Open
narender2031 opened this issue Sep 19, 2019 · 3 comments
Open

Disable new_google_recaptcha for test cases #12

narender2031 opened this issue Sep 19, 2019 · 3 comments

Comments

@narender2031
Copy link

error:

  WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: GET https://www.google.com/recaptcha/api/siteverify?response=&secret=6LfHB7kUAAAAAHTFLRZDh6o23ICu86HbLUXB_Ric with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'www.google.com', 'User-Agent'=>'Ruby'}
     
       You can stub this request with the following snippet:
     
       stub_request(:get, "https://www.google.com/recaptcha/api/siteverify?response=&secret=6LfHB7kUAAAAAHTFLRZDh6o23ICu86HbLUXB_Ric").
         with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'www.google.com', 'User-Agent'=>'Ruby'}).
         to_return(status: 200, body: "", headers: {})

How to add this in rails_helper.rb

module NewGoogleRecaptcha
      def self.human?(*attrs)
        true
      end
end
@adelnabiullin
Copy link
Contributor

@narender2031
Just add that code to the end of spec/rails_helper.rb like this:

RSpec.configure do |config|
...
end

module NewGoogleRecaptcha
  def self.human?(*attrs)
    true
  end
end

@igorkasyanchuk
Copy link
Owner

Can someone create a PR with a fix?

@adelnabiullin
Copy link
Contributor

@igorkasyanchuk what do you mean?
do you want to disable recaptcha requests in a test environment by default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants