validates_confirmation_of :password, :allow_nil => true
def before_create
- self.mail_notification = 'only_my_events'
+ self.mail_notification = Setting.default_notification_option
true
end
<p><%= setting_check_box :bcc_recipients %></p>
<p><%= setting_check_box :plain_text_mail %></p>
+
+<p><%= setting_select(:default_notification_option, User::MAIL_NOTIFICATION_OPTIONS.collect {|o| [l(o.last), o.first.to_s]}) %></p>
+
</div>
<fieldset class="box settings" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>
setting_start_of_week: Start calendars on
setting_rest_api_enabled: Enable REST web service
setting_cache_formatted_text: Cache formatted text
+ setting_default_notification_option: Default notification option
permission_add_project: Create project
permission_add_subprojects: Create subprojects
default: ''
rest_api_enabled:
default: 0
+default_notification_option:
+ default: 'only_my_events'
user.password, user.password_confirmation = "password", "password"
assert user.save
end
+
+ context "User#before_create" do
+ should "set the mail_notification to the default Setting" do
+ @user1 = User.generate_with_protected!
+ assert_equal 'only_my_events', @user1.mail_notification
+
+ with_settings :default_notification_option => 'all' do
+ @user2 = User.generate_with_protected!
+ assert_equal 'all', @user2.mail_notification
+ end
+ end
+ end
context "User.login" do
should "be case-insensitive." do