mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 21:04:33 +08:00
set locale for anonymous from header
set locale on signup update spec add locale option
This commit is contained in:
@ -479,6 +479,15 @@ describe UsersController do
|
||||
email: @user.email
|
||||
end
|
||||
|
||||
context 'when creating a user' do
|
||||
it 'sets the user locale to I18n.locale' do
|
||||
SiteSetting.stubs(:default_locale).returns('en')
|
||||
I18n.stubs(:locale).returns(:fr)
|
||||
post_user
|
||||
expect(User.find_by(username: @user.username).locale).to eq('fr')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when creating a non active user (unconfirmed email)' do
|
||||
|
||||
it 'returns a 500 when local logins are disabled' do
|
||||
@ -1181,6 +1190,19 @@ describe UsersController do
|
||||
|
||||
end
|
||||
|
||||
context 'a locale is chosen that differs from I18n.locale' do
|
||||
it "updates the user's locale" do
|
||||
I18n.stubs(:locale).returns('fr')
|
||||
|
||||
put :update,
|
||||
username: user.username,
|
||||
locale: :fa_IR
|
||||
|
||||
expect(User.find_by(username: user.username).locale).to eq('fa_IR')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "with user fields" do
|
||||
context "an editable field" do
|
||||
let!(:user_field) { Fabricate(:user_field) }
|
||||
|
Reference in New Issue
Block a user