J'ai ajouté une recaptcha gem et l'ai implémentée sur ma page d'inscription et de connexion. Mais peu de mes tests échouent. L'un des cas de test est la suivante:Le cas de test RSpec échoue après l'ajout de Recaptcha
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
j'avais ajouté Recaptcha.configuration.skip_verify_env.push("test")
à mon dossier config/initializers/recaptcha.rb
mais il échoue sur ma construction.
J'ai aussi ajouté:
scenario 'user signs up' do
Users::RegistrationsController.any_instance.stub(:check_captcha).and_return(true)
# Begin signup
visit new_user_registration_path
Mais dans les deux cas, je reçois la même erreur:
'save_and_open_page' va vous montrer comment la page ressemble, utile pour le débogage – usha