mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-06 02:51:34 +00:00
Email confirmation modal specs
This commit is contained in:
committed by
Maikel Linke
parent
595bc5d1a5
commit
f5a0862655
@@ -20,22 +20,26 @@ describe UserConfirmationsController, type: :controller do
|
||||
end
|
||||
|
||||
it "redirects the user to login" do
|
||||
expect(response).to redirect_to login_path
|
||||
expect(flash[:error]).to eq I18n.t('devise.user_confirmations.spree_user.not_confirmed')
|
||||
expect(response).to redirect_to login_path(confirmation: 'not_confirmed')
|
||||
end
|
||||
end
|
||||
|
||||
context "that has not been confirmed" do
|
||||
it "redirects the user to login" do
|
||||
spree_get :show, confirmation_token: unconfirmed_user.confirmation_token
|
||||
expect(response).to redirect_to login_path
|
||||
expect(flash[:success]).to eq I18n.t('devise.user_confirmations.spree_user.confirmed')
|
||||
expect(response).to redirect_to login_path(confirmation: 'confirmed')
|
||||
end
|
||||
|
||||
it "confirms the user" do
|
||||
spree_get :show, confirmation_token: unconfirmed_user.confirmation_token
|
||||
expect(unconfirmed_user.reload.confirmed_at).not_to eq(nil)
|
||||
end
|
||||
|
||||
it "redirects to previous url" do
|
||||
session[:confirmation_return_url] = producers_path + '#/login'
|
||||
spree_get :show, confirmation_token: unconfirmed_user.confirmation_token
|
||||
expect(response).to redirect_to producers_path + '#/login?confirmation=confirmed'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -78,10 +78,12 @@ feature "Authentication", js: true, retry: 3 do
|
||||
fill_in "Email", with: "test@foo.com"
|
||||
fill_in "Choose a password", with: "test12345"
|
||||
fill_in "Confirm password", with: "test12345"
|
||||
|
||||
expect do
|
||||
click_signup_button
|
||||
page.should have_content I18n.t('devise.user_registrations.spree_user.signed_up_but_unconfirmed')
|
||||
expect(page).to have_content I18n.t('devise.user_registrations.spree_user.signed_up_but_unconfirmed')
|
||||
end.to enqueue_job Delayed::PerformableMethod
|
||||
|
||||
expect(Delayed::Job.last.payload_object.method_name).to eq(:send_on_create_confirmation_instructions_without_delay)
|
||||
end
|
||||
end
|
||||
@@ -120,6 +122,14 @@ feature "Authentication", js: true, retry: 3 do
|
||||
end
|
||||
end
|
||||
|
||||
describe "after following email confirmation link" do
|
||||
scenario "shows confirmed message in modal" do
|
||||
visit '/#/login?confirmation=confirmed'
|
||||
expect(page).to have_login_modal
|
||||
expect(page).to have_content I18n.t('devise.confirmations.confirmed')
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Loggin by typing login/ redirects to /#/login" do
|
||||
visit "/login"
|
||||
uri = URI.parse(current_url)
|
||||
|
||||
Reference in New Issue
Block a user