Merge branch 'new_user_language' of https://github.com/alda519/diaspora
This commit is contained in:
commit
9ffeef9d20
2 changed files with 9 additions and 2 deletions
|
|
@ -365,7 +365,8 @@ class User < ActiveRecord::Base
|
||||||
def setup(opts)
|
def setup(opts)
|
||||||
self.username = opts[:username]
|
self.username = opts[:username]
|
||||||
self.email = opts[:email]
|
self.email = opts[:email]
|
||||||
self.language ||= 'en'
|
self.language = opts[:language]
|
||||||
|
self.language ||= I18n.locale.to_s
|
||||||
self.valid?
|
self.valid?
|
||||||
errors = self.errors
|
errors = self.errors
|
||||||
errors.delete :person
|
errors.delete :person
|
||||||
|
|
|
||||||
|
|
@ -216,9 +216,15 @@ describe User do
|
||||||
|
|
||||||
it "should save with current language if blank" do
|
it "should save with current language if blank" do
|
||||||
I18n.locale = :fr
|
I18n.locale = :fr
|
||||||
user = Factory(:user, :language => nil)
|
user = User.build(:username => 'max', :email => 'foo@bar.com', :password => 'password', :password_confirmation => 'password')
|
||||||
user.language.should == 'fr'
|
user.language.should == 'fr'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should save with language what is set" do
|
||||||
|
I18n.locale = :fr
|
||||||
|
user = User.build(:username => 'max', :email => 'foo@bar.com', :password => 'password', :password_confirmation => 'password', :language => 'de')
|
||||||
|
user.language.should == 'de'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue