aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/track_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/track_controller_spec.rb')
-rw-r--r--spec/controllers/track_controller_spec.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb
index 7ab1c0a70..5959c2bc1 100644
--- a/spec/controllers/track_controller_spec.rb
+++ b/spec/controllers/track_controller_spec.rb
@@ -31,6 +31,11 @@ describe TrackController, "when sending alerts for a track" do
include LinkToHelper # for main_url
it "should send alerts" do
+ # set the time the comment event happened at to within the last week
+ ire = info_request_events(:silly_comment_event)
+ ire.created_at = Time.now - 3.days
+ ire.save!
+
TrackMailer.alert_tracks
deliveries = ActionMailer::Base.deliveries
@@ -41,12 +46,19 @@ describe TrackController, "when sending alerts for a track" do
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
mail_token = $2
-
+
mail.body.should_not =~ /&/
+ mail.body.should_not include('sent a request') # request not included
+ mail.body.should_not include('sent a response') # response not included
+ mail.body.should include('added an annotation') # comment included
+
+ mail.body.should =~ /This a the daftest comment the world has ever seen/ # comment text included
+
# Check subscription managing link
-# XXX We can't do this, as it is redirecting to another control, so this is a
-# functional test. Bah, I so don't care, bit of an obsessive constraint.
+# XXX We can't do this, as it is redirecting to another controller. I'm
+# apparently meant to be writing controller unit tests here, not functional
+# tests. Bah, I so don't care, bit of an obsessive constraint.
# session[:user_id].should be_nil
# controller.test_code_redirect_by_email_token(mail_token, self) # XXX hack to avoid having to call User controller for email link
# session[:user_id].should == users(:silly_name_user).id