diff --git a/test/unit/person_notifier_test.rb b/test/unit/person_notifier_test.rb index 4def2d5..1da1704 100644 --- a/test/unit/person_notifier_test.rb +++ b/test/unit/person_notifier_test.rb @@ -78,7 +78,7 @@ class PersonNotifierTest < ActiveSupport::TestCase should 'schedule next mail at notification time' do @member.notification_time = 12 @member.notifier.schedule_next_notification_mail - assert_equal @member.notification_time, ((Delayed::Job.first.run_at - DateTime.now)/1.hour).round + assert_equal @member.notification_time, DateTime.now.hour - Delayed::Job.first.run_at.hour end should 'do not schedule duplicated notification mail' do @@ -127,7 +127,7 @@ class PersonNotifierTest < ActiveSupport::TestCase @member.notification_time = 12 @member.save! assert_equal 1, Delayed::Job.count - assert_equal @member.notification_time, ((Delayed::Job.first.run_at - DateTime.now)/1.hour).round + assert_equal @member.notification_time, DateTime.now.hour - Delayed::Job.first.run_at.hour end should 'display error message if fail to render a notificiation' do diff --git a/test/unit/person_test.rb b/test/unit/person_test.rb index 28f5a4f..d1d0060 100644 --- a/test/unit/person_test.rb +++ b/test/unit/person_test.rb @@ -1419,6 +1419,12 @@ class PersonTest < ActiveSupport::TestCase assert p.notifier.kind_of?(PersonNotifier) end + should 'reschedule next notification after update' do + p = fast_create(Person, :user_id => fast_create(User).id) + PersonNotifier.any_instance.expects(:reschedule_next_notification_mail).once + assert p.update_attribute(:name, 'Person name changed') + end + should 'merge memberships of plugins to original memberships' do class Plugin1 < Noosfero::Plugin def person_memberships(person) -- libgit2 0.21.2