0
gem recaptchaを追加して、サインアップとログインページに実装しました。 しかし、私のテストケースはほとんど失敗しています。テストケースの一つは次のとおりです。Recaptchaを追加した後にRSpecテストケースが失敗する
require 'rails_helper'
feature 'User sessions', js: true do
let(:organisation) {
FactoryGirl.create(:organisation, email_domain: 'example.com')
}
let!(:user) {
FactoryGirl.create(:user,
email: '[email protected]',
password: 'password',
organisation: organisation)
}
scenario 'user signs in and out' do
visit new_user_session_path
expect(page).to have_content 'Log in'
fill_in 'Email', with: '[email protected]'
fill_in 'Password', with: 'WRONG'
click_on 'Log in'
expect(page).to have_content 'Invalid Email or password.'
fill_in 'Email', with: '[email protected]'
fill_in 'Password', with: 'password'
click_on 'Log in'
find('.MenuContent-logout').click
expect(page).to have_text 'Log in'
end
end
私はconfig/initializers/recaptcha.rb
ファイルにRecaptcha.configuration.skip_verify_env.push("test")
を追加しましたが、それでも、それは私のビルドに失敗します。
私も追加:
scenario 'user signs up' do
Users::RegistrationsController.any_instance.stub(:check_captcha).and_return(true)
# Begin signup
visit new_user_registration_path
しかし、両方のケースで、私は同じエラー取得しています:それは私のビルド環境での設定の問題だったよう
は 'save_and_open_page'をデバッグするための有用な、ページがどのように見えるかを紹介しますのに役立ちます – usha