mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-29 21:17:17 +00:00
In this particular case, the user confirmations controller is redirecting to the reset password page but it doesnt know what is the raw reset_password_token So we regenerate the reset password token so that it can know what's the raw value for the redirect The method User#regenerate_reset_password_token is a proxy to the protected method in Devise::Recoverable
33 lines
977 B
Ruby
33 lines
977 B
Ruby
require "spec_helper"
|
|
|
|
feature "Confirm invitation as manager" do
|
|
include UIComponentHelper
|
|
include OpenFoodNetwork::EmailHelper
|
|
|
|
describe "confirm email and set password" do
|
|
let(:email) { "test@example.org" }
|
|
let(:user) { Spree::User.create(email: email, unconfirmed_email: email, password: "secret") }
|
|
|
|
before do
|
|
setup_email
|
|
user.reset_password_token = Devise.friendly_token
|
|
user.reset_password_sent_at = Time.now.utc
|
|
user.save!
|
|
end
|
|
|
|
it "lets the user set a password" do
|
|
visit spree.spree_user_confirmation_path(confirmation_token: user.confirmation_token)
|
|
|
|
expect(user.reload.confirmed?).to be true
|
|
expect(page).to have_text I18n.t(:change_my_password)
|
|
|
|
fill_in "Password", with: "my secret"
|
|
fill_in "Password Confirmation", with: "my secret"
|
|
click_button
|
|
|
|
expect(page).to have_no_text "Reset password token has expired"
|
|
expect(page).to be_logged_in_as user
|
|
end
|
|
end
|
|
end
|