aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/track_controller_spec.rb
diff options
context:
space:
mode:
authortony <tony>2009-03-19 12:30:03 +0000
committertony <tony>2009-03-19 12:30:03 +0000
commita6c405f3e893107ab1f3c944742a982376b98c4b (patch)
tree8dd0f0ab225a471fa79a324ecf34bad5ee5129c7 /spec/controllers/track_controller_spec.rb
parentc4d596476bf9d9a4734b2f9dac7a4458e9204f78 (diff)
Set up test info request and user beforehand
Diffstat (limited to 'spec/controllers/track_controller_spec.rb')
-rw-r--r--spec/controllers/track_controller_spec.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb
index af5b8dba2..248d94a74 100644
--- a/spec/controllers/track_controller_spec.rb
+++ b/spec/controllers/track_controller_spec.rb
@@ -4,18 +4,23 @@ describe TrackController, "when making a new track on a request" do
integrate_views
fixtures :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users
+ before do
+ @ir = info_requests(:fancy_dog_request)
+ @user = users(:bob_smith_user)
+ end
+
it "should require login when making new track" do
- get :track_request, :url_title => info_requests(:fancy_dog_request).url_title, :feed => 'track'
+ get :track_request, :url_title => @ir.url_title, :feed => 'track'
post_redirect = PostRedirect.get_last_post_redirect
response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token)
end
it "should make track and redirect if you are logged in " do
old_count = TrackThing.count
- session[:user_id] = users(:bob_smith_user).id
- get :track_request, :url_title => info_requests(:fancy_dog_request).url_title, :feed => 'track'
+ session[:user_id] = @user.id
+ get :track_request, :url_title => @ir.url_title, :feed => 'track'
TrackThing.count.should == old_count + 1
- response.should redirect_to(:controller => 'request', :action => 'show', :url_title => info_requests(:fancy_dog_request).url_title)
+ response.should redirect_to(:controller => 'request', :action => 'show', :url_title => @ir.url_title)
end
end