diff options
Diffstat (limited to 'spec/models/track_mailer_spec.rb')
-rw-r--r-- | spec/models/track_mailer_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/models/track_mailer_spec.rb b/spec/models/track_mailer_spec.rb index 4f5499a90..1bf77dab5 100644 --- a/spec/models/track_mailer_spec.rb +++ b/spec/models/track_mailer_spec.rb @@ -25,6 +25,7 @@ describe TrackMailer do :get_locale => 'en', :should_be_emailed? => true) User.stub!(:find).and_return([@user]) + @user.stub!(:receive_email_alerts).and_return(true) @user.stub!(:no_xapian_reindex=) end @@ -122,6 +123,7 @@ describe TrackMailer do :url_name => 'test-name', :should_be_emailed? => false) User.stub!(:find).and_return([@user]) + @user.stub!(:receive_email_alerts).and_return(true) @user.stub!(:no_xapian_reindex=) end @@ -131,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) |