@@ -86,31 +86,25 class UserTest < ActiveSupport::TestCase | |||
|
86 | 86 | assert user.save |
|
87 | 87 | end |
|
88 | 88 | |
|
89 | context "User#before_create" do | |
|
90 | should "set the mail_notification to the default Setting" do | |
|
91 | @user1 = User.generate! | |
|
92 | assert_equal 'only_my_events', @user1.mail_notification | |
|
93 | ||
|
94 | with_settings :default_notification_option => 'all' do | |
|
95 | @user2 = User.generate! | |
|
96 | assert_equal 'all', @user2.mail_notification | |
|
97 | end | |
|
89 | def test_user_before_create_should_set_the_mail_notification_to_the_default_setting | |
|
90 | @user1 = User.generate! | |
|
91 | assert_equal 'only_my_events', @user1.mail_notification | |
|
92 | with_settings :default_notification_option => 'all' do | |
|
93 | @user2 = User.generate! | |
|
94 | assert_equal 'all', @user2.mail_notification | |
|
98 | 95 | end |
|
99 | 96 | end |
|
100 | 97 | |
|
101 | context "User.login" do | |
|
102 | should "be case-insensitive." do | |
|
103 | u = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo") | |
|
104 | u.login = 'newuser' | |
|
105 | u.password, u.password_confirmation = "password", "password" | |
|
106 | assert u.save | |
|
107 | ||
|
108 | u = User.new(:firstname => "Similar", :lastname => "User", :mail => "similaruser@somenet.foo") | |
|
109 | u.login = 'NewUser' | |
|
110 | u.password, u.password_confirmation = "password", "password" | |
|
111 | assert !u.save | |
|
112 | assert_include I18n.translate('activerecord.errors.messages.taken'), u.errors[:login] | |
|
113 | end | |
|
98 | def test_user_login_be_case_insensitive | |
|
99 | u = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo") | |
|
100 | u.login = 'newuser' | |
|
101 | u.password, u.password_confirmation = "password", "password" | |
|
102 | assert u.save | |
|
103 | u = User.new(:firstname => "Similar", :lastname => "User", :mail => "similaruser@somenet.foo") | |
|
104 | u.login = 'NewUser' | |
|
105 | u.password, u.password_confirmation = "password", "password" | |
|
106 | assert !u.save | |
|
107 | assert_include I18n.translate('activerecord.errors.messages.taken'), u.errors[:login] | |
|
114 | 108 | end |
|
115 | 109 | |
|
116 | 110 | def test_mail_uniqueness_should_not_be_case_sensitive |
General Comments 0
You need to be logged in to leave comments.
Login now