如何在设计sign_in上使用rspecs测试recapcha?

时间:2018-05-11 08:02:52

标签: ruby-on-rails rspec devise recaptcha

例如,我有以下代码:

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'

0 个答案:

没有答案