fixed broken test, spec added
This commit is contained in:
parent
0906f21bdd
commit
a9e4b4ce99
2 changed files with 8 additions and 1 deletions
|
|
@ -360,6 +360,8 @@ class User < ActiveRecord::Base
|
|||
def setup(opts)
|
||||
self.username = opts[:username]
|
||||
self.email = opts[:email]
|
||||
self.language = opts[:language]
|
||||
self.language ||= I18n.locale.to_s
|
||||
self.valid?
|
||||
errors = self.errors
|
||||
errors.delete :person
|
||||
|
|
|
|||
|
|
@ -203,9 +203,14 @@ describe User do
|
|||
it "should save with current language if blank" do
|
||||
I18n.locale = :fr
|
||||
user = User.build(:username => 'max', :email => 'foo@bar.com', :password => 'password', :password_confirmation => 'password')
|
||||
user.save!
|
||||
user.language.should == 'fr'
|
||||
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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue