Skip to content

Commit

Permalink
Fix missing translation (#10)
Browse files Browse the repository at this point in the history
Co-authored-by: Quentin Champ <[email protected]>
  • Loading branch information
paulinebessoles and Quentinchampenois authored Mar 22, 2022
1 parent ef002f3 commit 11e59ad
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ ignore_unused:
- devise.address.no_match
- activemodel.attributes.user.*
- faker.address.country_code
- errors.messages.extension_whitelist_error
# - 'activerecord.attributes.*'
# - '{devise,kaminari,will_paginate}.*'
# - 'simple_form.{yes,no}'
Expand Down
28 changes: 28 additions & 0 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.

class RandomStalling < Devise::FailureApp
def respond
sleep rand * 5
super
end

protected

def i18n_options(options)
options[:locale] = session[:user_locale]
super
end
end

Devise.setup do |config|
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming their account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming their account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming their account.
config.allow_unconfirmed_access_for = 0.days
end
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ en:
registrations:
new:
sign_up: Sign up
errors:
messages:
extension_whitelist_error: File must be filled
faker:
address:
country_code:
Expand Down
3 changes: 3 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ fr:
registrations:
new:
sign_up: S'inscrire
errors:
messages:
extension_whitelist_error: Le fichier doit être rempli
faker:
address:
country_code:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# This migration comes from decidim_decidim_awesome (originally 20210628150825)

class ChangeAwesomeConfigVarType < ActiveRecord::Migration[5.2]
Expand Down
10 changes: 5 additions & 5 deletions spec/system/authentication_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def fill_user_fields(user: "[email protected]", robot: false)
find("*[type=submit]").click
end

expect(page).to have_content("You have signed up successfully")
expect(page).to have_content("A message with a confirmation link has been sent to your email address. Please follow the link to activate your account.")
end

context "when user fills the form" do
Expand All @@ -96,7 +96,7 @@ def fill_user_fields(user: "[email protected]", robot: false)
find("*[type=submit]").click
end

expect(page).to have_content("You have signed up successfully")
expect(page).to have_content("A message with a confirmation link has been sent to your email address. Please follow the link to activate your account.")
end
end
end
Expand All @@ -116,7 +116,7 @@ def fill_user_fields(user: "[email protected]", robot: false)
find("*[type=submit]").click
end

expect(page).to have_content("¡Bienvenida! Te has registrado con éxito.")
expect(page).to have_content("Se ha enviado un mensaje con un enlace de confirmación a tu dirección de correo electrónico. Por favor, sigue el enlace para activar tu cuenta.")
expect(last_user.locale).to eq("es")
end
end
Expand All @@ -130,7 +130,7 @@ def fill_user_fields(user: "[email protected]", robot: false)
find("*[type=submit]").click
end

expect(page).not_to have_content("You have signed up successfully")
expect(page).not_to have_content("A message with a confirmation link has been sent to your email address. Please follow the link to activate your account.You have signed up successfully")
end
end

Expand Down Expand Up @@ -579,7 +579,7 @@ def fill_user_fields(user: "[email protected]", robot: false)
find("*[type=submit]").click
end

expect(page).to have_content("You have signed up successfully")
expect(page).to have_content("A message with a confirmation link has been sent to your email address. Please follow the link to activate your account.")
end
end
end
Expand Down

0 comments on commit 11e59ad

Please sign in to comment.