summaryrefslogtreecommitdiffstats
path: root/test/unit/event_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/event_test.rb')
-rw-r--r--test/unit/event_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/event_test.rb b/test/unit/event_test.rb
index c9c9284..8a2b885 100644
--- a/test/unit/event_test.rb
+++ b/test/unit/event_test.rb
@@ -151,4 +151,25 @@ class EventTest < ActiveSupport::TestCase
end
end
end
+
+ context "favorite notification" do
+ setup do
+ @event = new_event(:action => Action::PUSH)
+ @favorite = users(:mike).favorites.new(:watchable => @repository)
+ @favorite.notify_by_email = true
+ @favorite.save!
+ end
+
+ should "find the favorites for the watchable with email notification turned on" do
+ assert_equal [@favorite], @event.favorites_for_email_notification
+ @favorite.update_attributes(:notify_by_email => false)
+ assert_equal [], @event.favorites_for_email_notification
+ end
+
+ should "tell the Favorite instances with email notification to notify" do
+ @event.expects(:favorites_for_email_notification).returns([@favorite])
+ @favorite.expects(:notify_about_event).with(@event)
+ @event.save!
+ end
+ end
end