From 9e08e323fcdcf763d76ede20807893f6bbfb7fbf Mon Sep 17 00:00:00 2001 From: francis Date: Thu, 1 Nov 2007 14:45:56 +0000 Subject: Save post request properly into database with a model, as a record of where to redirect back to after login. Token generation for these saved logins. --- spec/controllers/request_controller_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'spec/controllers/request_controller_spec.rb') diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 41ff2b6b6..7ba066ad2 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -74,7 +74,13 @@ describe RequestController, "when creating a new request" do post :create, :info_request => { :public_body_id => public_bodies(:geraldine_public_body).id, :title => "Why is your quango called Geraldine?"}, :outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." } - response.should redirect_to(:controller => 'user', :action => 'signin') + # XXX yeuch - no other easy way of getting the token so we can check + # the redirect URL, as it is by definition opaque to the controller + # apart from in the place that it redirects to. + post_redirects = PostRedirect.find_by_sql("select * from post_redirects order by id desc limit 1") + post_redirects.size.should == 1 + post_redirect = post_redirects[0] + response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token) end it "should create the request and outgoing message and redirec to request page when input is good and somebody is logged in" do -- cgit v1.2.3