From fa57e3746740af418aee7aa45872886a5305a37d Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Wed, 15 Feb 2023 10:23:58 +0100 Subject: [PATCH] Remove I18n keys in User ctrllers spec --- spec/controllers/user_confirmations_controller_spec.rb | 2 +- spec/controllers/user_passwords_controller_spec.rb | 8 +++++--- spec/controllers/user_registrations_controller_spec.rb | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/spec/controllers/user_confirmations_controller_spec.rb b/spec/controllers/user_confirmations_controller_spec.rb index fd32ca2a37..376356b08b 100644 --- a/spec/controllers/user_confirmations_controller_spec.rb +++ b/spec/controllers/user_confirmations_controller_spec.rb @@ -67,7 +67,7 @@ describe UserConfirmationsController, type: :controller do it "redirects the user to login" do spree_post :create, spree_user: { email: unconfirmed_user.email } expect(response).to redirect_to login_path - expect(flash[:success]).to eq I18n.t('devise.user_confirmations.spree_user.confirmation_sent') + expect(flash[:success]).to eq 'Email confirmation sent' end it "sends the confirmation email" do diff --git a/spec/controllers/user_passwords_controller_spec.rb b/spec/controllers/user_passwords_controller_spec.rb index a2e5861455..7ba17274b8 100644 --- a/spec/controllers/user_passwords_controller_spec.rb +++ b/spec/controllers/user_passwords_controller_spec.rb @@ -16,19 +16,21 @@ describe UserPasswordsController, type: :controller do it "returns 404 if user is not found" do spree_post :create, spree_user: { email: "xxxxxxxxxx@example.com" } expect(response.status).to eq 404 - expect(response.body).to match I18n.t(:email_not_found) + expect(response.body).to match 'Email address not found' end it "returns 422 if user is registered but not confirmed" do spree_post :create, spree_user: { email: unconfirmed_user.email } expect(response.status).to eq 422 - expect(response.body).to match I18n.t(:email_unconfirmed) + expect(response.body).to match "You must confirm your email \ +address before you can reset your password." end it "returns 200 when password reset was successful" do spree_post :create, spree_user: { email: user.email } expect(response.status).to eq 200 - expect(response.body).to match I18n.t(:password_reset_sent) + expect(response.body).to match "An email with instructions on resetting \ +your password has been sent!" end end diff --git a/spec/controllers/user_registrations_controller_spec.rb b/spec/controllers/user_registrations_controller_spec.rb index 9e77be34f2..990b8108e7 100644 --- a/spec/controllers/user_registrations_controller_spec.rb +++ b/spec/controllers/user_registrations_controller_spec.rb @@ -39,7 +39,10 @@ describe UserRegistrationsController, type: :controller do expect(response.status).to eq(401) json = JSON.parse(response.body) - expect(json).to eq("message" => I18n.t('devise.user_registrations.spree_user.unknown_error')) + expect(json).to eq( + "message" => + 'Something went wrong while creating your account. Check your email address and try again.' + ) end it "returns 200 when registration succeeds" do