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.rb9
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