@@ -368,7 +368,7 class User < Principal | |||||
368 |
|
368 | |||
369 | def notified_project_ids=(ids) |
|
369 | def notified_project_ids=(ids) | |
370 | @notified_projects_ids_changed = true |
|
370 | @notified_projects_ids_changed = true | |
371 | @notified_projects_ids = ids |
|
371 | @notified_projects_ids = ids.map(&:to_i).uniq.select {|n| n > 0} | |
372 | end |
|
372 | end | |
373 |
|
373 | |||
374 | # Updates per project notifications (after_save callback) |
|
374 | # Updates per project notifications (after_save callback) |
@@ -948,6 +948,11 class UserTest < ActiveSupport::TestCase | |||||
948 | assert_equal 6, User.valid_notification_options(User.find(2)).size |
|
948 | assert_equal 6, User.valid_notification_options(User.find(2)).size | |
949 | end |
|
949 | end | |
950 |
|
950 | |||
|
951 | def test_notified_project_ids_setter_should_coerce_to_unique_integer_array | |||
|
952 | @jsmith.notified_project_ids = ["1", "123", "2u", "wrong", "12", 6, 12, -35, ""] | |||
|
953 | assert_equal [1, 123, 2, 12, 6], @jsmith.notified_projects_ids | |||
|
954 | end | |||
|
955 | ||||
951 | def test_mail_notification_all |
|
956 | def test_mail_notification_all | |
952 | @jsmith.mail_notification = 'all' |
|
957 | @jsmith.mail_notification = 'all' | |
953 | @jsmith.notified_project_ids = [] |
|
958 | @jsmith.notified_project_ids = [] |
General Comments 0
You need to be logged in to leave comments.
Login now