例如,我有以下代码:
context '#update_password' do
it 'current_user can update his password' do
user = FactoryBot.create :user
sign_in user
put :update_password, xhr: true, params: {
id: user.id,
user: {
id: user.id,
current_password: user.password,
password: 'ValidPass1!'
}
}
expect(response).to be_success
end
end
如何编写rspec测试以验证sign_in上的recapcha有效性?
P.S。我正在使用gem 'recaptcha', require: 'recaptcha/rails'