aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-05-16 12:01:18 +0100
committerSeb Bacon <seb.bacon@gmail.com>2012-05-30 13:50:38 +0100
commit3b45584eff8feab3f836d036c26cb24034686d6c (patch)
tree2deeebe49fe22ed3ea174804534a750abc527570
parent302769c8d848ed958ef214f726f8b0bd9ab359d1 (diff)
Test to ensure users who have opted out of alert emails don't get any
-rw-r--r--spec/models/track_mailer_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/models/track_mailer_spec.rb b/spec/models/track_mailer_spec.rb
index 21611a58d..1bf77dab5 100644
--- a/spec/models/track_mailer_spec.rb
+++ b/spec/models/track_mailer_spec.rb
@@ -133,6 +133,13 @@ describe TrackMailer do
TrackMailer.alert_tracks
end
+ it 'should not ask for any daily track things for the user if they have receive_email_alerts off but could otherwise be emailed' do
+ @user.stub(:should_be_emailed?).and_return(true)
+ @user.stub(:receive_email_alerts).and_return(false)
+ expected_conditions = [ "tracking_user_id = ? and track_medium = ?", @user.id, 'email_daily' ]
+ TrackThing.should_not_receive(:find).with(:all, :conditions => expected_conditions).and_return([])
+ TrackMailer.alert_tracks
+ end
it 'should not set the no_xapian_reindex flag on the user' do
@user.should_not_receive(:no_xapian_reindex=).with(true)