diff options
author | Francis Irving <francis@mysociety.org> | 2010-07-13 23:54:46 +0100 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-07-13 23:54:46 +0100 |
commit | 59395b3bdf19aed7bf5f77656afa6c31dad7e138 (patch) | |
tree | b6e4c9f9e5b4a9f792a550ce3af727ae32b1cba1 /spec/controllers/track_controller_spec.rb | |
parent | 452ac41f05f655a9fd23c8df4796f26632c23050 (diff) | |
parent | da2c0aaf5f0d07baa3a355033a92d5dd295f2f13 (diff) |
Merge branch 'master' into francis-profile-photo
Conflicts:
app/views/user/show.rhtml
commonlib
spec/controllers/user_controller_spec.rb
Diffstat (limited to 'spec/controllers/track_controller_spec.rb')
-rw-r--r-- | spec/controllers/track_controller_spec.rb | 18 |
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 |