forked from fixin.me/fixin.me
Fix translations and enable i18n testing
This commit is contained in:
parent
3509cd409c
commit
e4f595a329
@ -73,7 +73,7 @@ module ApplicationHelper
|
||||
|
||||
content_tag :div, class: "right" do
|
||||
if current_user.at_least(:admin)
|
||||
image_link_to t('.users'), "account-multiple-outline", users_path, class: "tab",
|
||||
image_link_to t(".users"), "account-multiple-outline", users_path, class: "tab",
|
||||
current: :active
|
||||
end
|
||||
end
|
||||
|
@ -13,9 +13,10 @@
|
||||
<div class="app-menu">
|
||||
<% if user_signed_in? %>
|
||||
<% if current_user_disguised? %>
|
||||
<%= image_button_to t(:revert), "incognito-off", revert_users_path %>
|
||||
<%= image_button_to t(".revert"), "incognito-off", revert_users_path %>
|
||||
<% else %>
|
||||
<%= image_button_to t(:sign_out), "logout", destroy_user_session_path, method: :delete %>
|
||||
<%= image_button_to t(".sign_out"), "logout", destroy_user_session_path,
|
||||
method: :delete %>
|
||||
<% end %>
|
||||
<%= image_link_to current_user.email, "account-wrench-outline",
|
||||
edit_user_registration_path, current: :hide %>
|
||||
|
@ -1,11 +1,11 @@
|
||||
<%= tabular_form_for resource, url: user_password_path, html: { method: :put } do |f| %>
|
||||
<%= f.hidden_field :reset_password_token, label: false %>
|
||||
|
||||
<%= f.password_field :password, label: t('.new_password'),
|
||||
<%= f.password_field :password, label: t(".new_password"),
|
||||
required: true, size: 30, autofocus: true, autocomplete: "new-password",
|
||||
hint: ("(#{@minimum_password_length} characters minimum)" if @minimum_password_length) %>
|
||||
<%= f.password_field :password_confirmation, label: t('.password_confirmation'),
|
||||
<%= f.password_field :password_confirmation, label: t(".password_confirmation"),
|
||||
required: true, size: 30, autocomplete: "new-password" %>
|
||||
|
||||
<%= f.submit t('.update_password') %>
|
||||
<%= f.submit t(".update_password") %>
|
||||
<% end %>
|
||||
|
@ -21,9 +21,9 @@
|
||||
<%= f.select :status, User.statuses, readonly: true %>
|
||||
|
||||
<%= f.password_field :password, size: 30, autocomplete: "off",
|
||||
hint: t('.blank_password_hint_html',
|
||||
subhint: t('.minimum_length_hint_html', count: @minimum_password_length)) %>
|
||||
hint: t(".blank_password_hint_html",
|
||||
subhint: t(".minimum_length_hint_html", count: @minimum_password_length)) %>
|
||||
<%= f.password_field :password_confirmation, size: 30, autocomplete: "off" %>
|
||||
|
||||
<%= f.submit t('.update') %>
|
||||
<%= f.submit t(".update") %>
|
||||
<% end %>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<%= f.password_field :password, required: true, size: 30, minlength: @minimum_password_length,
|
||||
autocomplete: "new-password",
|
||||
hint: ("(#{@minimum_password_length} characters minimum)" if @minimum_password_length) %>
|
||||
<%= f.password_field :password_confirmation, label: t('.password_confirmation'),
|
||||
<%= f.password_field :password_confirmation, label: t(".password_confirmation"),
|
||||
required: true, size: 30, autocomplete: "new-password" %>
|
||||
|
||||
<%= f.submit t(:register) %>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<%= f.password_field :password, required: true, size: 30, autocomplete: "current-password" %>
|
||||
|
||||
<% if devise_mapping.rememberable? %>
|
||||
<%= f.check_box :remember_me, label: t('.remember_me') %>
|
||||
<%= f.check_box :remember_me, label: t(".remember_me") %>
|
||||
<% end %>
|
||||
|
||||
<%= f.submit t(:sign_in) %>
|
||||
|
@ -52,7 +52,7 @@ Rails.application.configure do
|
||||
config.active_support.disallowed_deprecation_warnings = []
|
||||
|
||||
# Raises error for missing translations.
|
||||
# config.i18n.raise_on_missing_translations = true
|
||||
config.i18n.raise_on_missing_translations = true
|
||||
|
||||
# Annotate rendered view with file names.
|
||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
@ -35,13 +35,12 @@ en:
|
||||
layouts:
|
||||
application:
|
||||
revert: Revert
|
||||
sign_out: Sign out
|
||||
users: Users
|
||||
actions: Actions
|
||||
back: Back
|
||||
or: or
|
||||
profile: Profile
|
||||
register: Register
|
||||
sign_in: Sign in
|
||||
sign_out: Sign out
|
||||
recover_password: Recover password
|
||||
resend_confirmation: Resend confirmation
|
||||
|
@ -8,21 +8,21 @@ class UsersTest < ApplicationSystemTestCase
|
||||
test "sign in" do
|
||||
sign_in
|
||||
assert_no_current_path new_user_session_path
|
||||
assert_text t('devise.sessions.signed_in')
|
||||
assert_text t("devise.sessions.signed_in")
|
||||
end
|
||||
|
||||
test "sign in fails with invalid password" do
|
||||
sign_in password: random_password
|
||||
assert_current_path new_user_session_path
|
||||
assert_text t('devise.failure.invalid', authentication_keys: User.human_attribute_name(:email))
|
||||
assert_text t("devise.failure.invalid", authentication_keys: User.human_attribute_name(:email))
|
||||
end
|
||||
|
||||
test "sign out" do
|
||||
sign_in
|
||||
visit root_url
|
||||
click_on t(:sign_out)
|
||||
click_on t("layouts.application.sign_out")
|
||||
assert_current_path new_user_session_path
|
||||
assert_text t('devise.sessions.signed_out')
|
||||
assert_text t("devise.sessions.signed_out")
|
||||
end
|
||||
|
||||
test "recover password" do
|
||||
@ -35,19 +35,19 @@ class UsersTest < ApplicationSystemTestCase
|
||||
click_on t(:recover_password)
|
||||
end
|
||||
assert_current_path new_user_session_path
|
||||
assert_text t('devise.passwords.send_instructions')
|
||||
assert_text t("devise.passwords.send_instructions")
|
||||
|
||||
with_last_email do |mail|
|
||||
visit Capybara.string(mail.body.to_s).find_link("Change my password")[:href]
|
||||
end
|
||||
new_password = random_password
|
||||
fill_in t('users.passwords.edit.new_password'), with: new_password
|
||||
fill_in t('users.passwords.edit.password_confirmation'), with: new_password
|
||||
fill_in t("users.passwords.edit.new_password"), with: new_password
|
||||
fill_in t("users.passwords.edit.password_confirmation"), with: new_password
|
||||
assert_emails 1 do
|
||||
click_on t('users.passwords.edit.update_password')
|
||||
click_on t("users.passwords.edit.update_password")
|
||||
end
|
||||
assert_no_current_path user_password_path
|
||||
assert_text t('devise.passwords.updated')
|
||||
assert_text t("devise.passwords.updated")
|
||||
end
|
||||
|
||||
test "register" do
|
||||
@ -57,7 +57,7 @@ class UsersTest < ApplicationSystemTestCase
|
||||
fill_in User.human_attribute_name(:email).capitalize, with: random_email
|
||||
password = random_password
|
||||
fill_in User.human_attribute_name(:password).capitalize, with: password
|
||||
fill_in t('users.registrations.new.password_confirmation'), with: password
|
||||
fill_in t("users.registrations.new.password_confirmation"), with: password
|
||||
assert_difference ->{User.count}, 1 do
|
||||
assert_emails 1 do
|
||||
click_on t(:register)
|
||||
@ -65,13 +65,13 @@ class UsersTest < ApplicationSystemTestCase
|
||||
end
|
||||
|
||||
assert_no_current_path new_user_registration_path
|
||||
assert_text t('devise.registrations.signed_up_but_unconfirmed')
|
||||
assert_text t("devise.registrations.signed_up_but_unconfirmed")
|
||||
|
||||
with_last_email do |mail|
|
||||
visit Capybara.string(mail.body.to_s).find_link("Confirm my account")[:href]
|
||||
end
|
||||
assert_current_path new_user_session_path
|
||||
assert_text t('devise.confirmations.confirmed')
|
||||
assert_text t("devise.confirmations.confirmed")
|
||||
assert User.last.confirmed?
|
||||
end
|
||||
|
||||
@ -86,7 +86,7 @@ class UsersTest < ApplicationSystemTestCase
|
||||
click_on t(:resend_confirmation)
|
||||
end
|
||||
assert_current_path new_user_session_path
|
||||
assert_text t('devise.confirmations.send_instructions')
|
||||
assert_text t("devise.confirmations.send_instructions")
|
||||
|
||||
with_last_email do |mail|
|
||||
visit Capybara.string(mail.body.to_s).find_link("Confirm my account")[:href]
|
||||
@ -95,7 +95,7 @@ class UsersTest < ApplicationSystemTestCase
|
||||
|
||||
test "show profile" do
|
||||
sign_in user: users.select(&:admin?).select(&:confirmed?).sample
|
||||
click_on t('layouts.application.users')
|
||||
click_on t("layouts.application.users")
|
||||
within all('tr').drop(1).sample do |tr|
|
||||
email = first(:link).text
|
||||
click_on email
|
||||
@ -107,7 +107,7 @@ class UsersTest < ApplicationSystemTestCase
|
||||
user = users.select(&:admin?).select(&:confirmed?).sample
|
||||
sign_in user: user
|
||||
|
||||
click_on t('layouts.application.users')
|
||||
click_on t("layouts.application.users")
|
||||
all(:link_or_button, text: t("users.index.disguise")).sample.click
|
||||
assert_current_path edit_user_registration_path
|
||||
# TODO: test for profile app-menu link after root changed to different path
|
||||
@ -122,8 +122,8 @@ class UsersTest < ApplicationSystemTestCase
|
||||
user = users.select(&:admin?).select(&:confirmed?).sample
|
||||
sign_in user: user
|
||||
|
||||
click_on t('layouts.application.users')
|
||||
text = t('users.index.disguise')
|
||||
click_on t("layouts.application.users")
|
||||
text = t("users.index.disguise")
|
||||
undisguisable = all(:xpath, "//tbody//tr[not(descendant::*[contains(text(),\"#{text}\")])]")
|
||||
within undisguisable.sample do |tr|
|
||||
email = first(:link).text
|
||||
@ -144,8 +144,8 @@ class UsersTest < ApplicationSystemTestCase
|
||||
end
|
||||
assert_difference ->{ User.count }, -1 do
|
||||
# TODO: accept_confirm when modal dialog is working
|
||||
#accept_confirm { click_on t('users.registrations.edit.delete') }
|
||||
click_on t('users.registrations.edit.delete')
|
||||
#accept_confirm { click_on t("users.registrations.edit.delete") }
|
||||
click_on t("users.registrations.edit.delete")
|
||||
end
|
||||
assert_current_path new_user_session_path
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user