Commit e8f28cae0c075a31885ac2b6bbab943a18a3bf88
1 parent
645f9328
Exists in
master
and in
23 other branches
Fix and add missing tests
(ActionItem2694)
Showing
2 changed files
with
8 additions
and
2 deletions
Show diff stats
test/unit/person_notifier_test.rb
| ... | ... | @@ -78,7 +78,7 @@ class PersonNotifierTest < ActiveSupport::TestCase |
| 78 | 78 | should 'schedule next mail at notification time' do |
| 79 | 79 | @member.notification_time = 12 |
| 80 | 80 | @member.notifier.schedule_next_notification_mail |
| 81 | - assert_equal @member.notification_time, ((Delayed::Job.first.run_at - DateTime.now)/1.hour).round | |
| 81 | + assert_equal @member.notification_time, DateTime.now.hour - Delayed::Job.first.run_at.hour | |
| 82 | 82 | end |
| 83 | 83 | |
| 84 | 84 | should 'do not schedule duplicated notification mail' do |
| ... | ... | @@ -127,7 +127,7 @@ class PersonNotifierTest < ActiveSupport::TestCase |
| 127 | 127 | @member.notification_time = 12 |
| 128 | 128 | @member.save! |
| 129 | 129 | assert_equal 1, Delayed::Job.count |
| 130 | - assert_equal @member.notification_time, ((Delayed::Job.first.run_at - DateTime.now)/1.hour).round | |
| 130 | + assert_equal @member.notification_time, DateTime.now.hour - Delayed::Job.first.run_at.hour | |
| 131 | 131 | end |
| 132 | 132 | |
| 133 | 133 | should 'display error message if fail to render a notificiation' do | ... | ... |
test/unit/person_test.rb
| ... | ... | @@ -1419,6 +1419,12 @@ class PersonTest < ActiveSupport::TestCase |
| 1419 | 1419 | assert p.notifier.kind_of?(PersonNotifier) |
| 1420 | 1420 | end |
| 1421 | 1421 | |
| 1422 | + should 'reschedule next notification after update' do | |
| 1423 | + p = fast_create(Person, :user_id => fast_create(User).id) | |
| 1424 | + PersonNotifier.any_instance.expects(:reschedule_next_notification_mail).once | |
| 1425 | + assert p.update_attribute(:name, 'Person name changed') | |
| 1426 | + end | |
| 1427 | + | |
| 1422 | 1428 | should 'merge memberships of plugins to original memberships' do |
| 1423 | 1429 | class Plugin1 < Noosfero::Plugin |
| 1424 | 1430 | def person_memberships(person) | ... | ... |