aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-05-30 13:52:32 +0100
committerSeb Bacon <seb.bacon@gmail.com>2012-05-30 13:52:32 +0100
commit4387c6a45d12b9ffab398fcba28deb5669ada4f0 (patch)
treed263d4d7ca778051d80072eb50e0c72f4481d1dd /spec/models
parentfe09c8da70967ea591a3b01d7a70fc80490f3d8f (diff)
parent22d0a41bd63fca4b3b4d69018c6fa6d52010f42f (diff)
Merge branch 'feature/follow-buttons' into develop
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/track_mailer_spec.rb9
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)