diff options
author | francis <francis> | 2009-03-17 23:22:01 +0000 |
---|---|---|
committer | francis <francis> | 2009-03-17 23:22:01 +0000 |
commit | 2ba3e9f0ae73fdee828ad25d6f2d0ed2cd3d8015 (patch) | |
tree | 58b1c34b28576ff7eccbddfc29dc2e8a0b682222 /spec/controllers/track_controller_spec.rb | |
parent | 7087357359b39a7b039a4c37e1eddcb676e704f0 (diff) |
Make it redirect to email subscription # reference in user page when you
click unsubscribe link in email.
Diffstat (limited to 'spec/controllers/track_controller_spec.rb')
-rw-r--r-- | spec/controllers/track_controller_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index 1e273b3fe..a2092acc0 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -23,6 +23,7 @@ end describe TrackController, "when sending alerts for a track" do integrate_views fixtures :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :track_things_sent_emails + include LinkToHelper # for main_url it "should send alerts" do TrackMailer.alert_tracks @@ -39,7 +40,8 @@ describe TrackController, "when sending alerts for a track" do mail.body.should_not =~ /&/ # Check subscription managing link -# XXX reenable this if we ever have a page manager in the track controller +# 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. # 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 @@ -47,6 +49,11 @@ describe TrackController, "when sending alerts for a track" do # response.should render_template('users/show') # assigns[:display_user].should == users(:silly_name_user) + # Given we can't click the link, check the token is right instead + post_redirect = PostRedirect.find_by_email_token(mail_token) + expected_url = main_url("/user/" + users(:silly_name_user).url_name + "#email_subscriptions") # XXX can't call URL making functions here, what is correct way to do this? + post_redirect.uri.should == expected_url + # Check nothing more is delivered if we try again deliveries.clear TrackMailer.alert_tracks |