From 3b45584eff8feab3f836d036c26cb24034686d6c Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Wed, 16 May 2012 12:01:18 +0100 Subject: Test to ensure users who have opted out of alert emails don't get any --- spec/models/track_mailer_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec/models') 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) -- cgit v1.2.3