aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cabo <david@calibea.com>2011-08-13 20:49:37 +0200
committerDavid Cabo <david@calibea.com>2011-08-13 20:49:37 +0200
commit03bb6db9b7ca77d2e438d8fa1c8a4ad41327a04d (patch)
treec00729830f7cdeb90d39a455b374311b39c3eaaf
parentdf1754847892bb6abce2681a42d8c50cf8d3a2da (diff)
Update tests to reflect sign-in is now before Preview when making new request
-rw-r--r--spec/controllers/request_controller_spec.rb25
1 files changed, 13 insertions, 12 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 516aa602f..500a30bd0 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -322,7 +322,20 @@ describe RequestController, "when creating a new request" do
response.should render_template('new')
end
+ it "should redirect to sign in page when input is good and nobody is logged in" do
+ params = { :info_request => { :public_body_id => @body.id,
+ :title => "Why is your quango called Geraldine?", :tag_string => "" },
+ :outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." },
+ :submitted_new_request => 1, :preview => 1
+ }
+ post :new, params
+ post_redirect = PostRedirect.get_last_post_redirect
+ response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token)
+ # post_redirect.post_params.should == params # XXX get this working. there's a : vs '' problem amongst others
+ end
+
it "should show preview when input is good" do
+ session[:user_id] = @user.id
post :new, { :info_request => { :public_body_id => @body.id,
:title => "Why is your quango called Geraldine?", :tag_string => "" },
:outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." },
@@ -340,18 +353,6 @@ describe RequestController, "when creating a new request" do
response.should render_template('new')
end
- it "should redirect to sign in page when input is good and nobody is logged in" do
- params = { :info_request => { :public_body_id => @body.id,
- :title => "Why is your quango called Geraldine?", :tag_string => "" },
- :outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." },
- :submitted_new_request => 1, :preview => 0
- }
- post :new, params
- post_redirect = PostRedirect.get_last_post_redirect
- response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token)
- # post_redirect.post_params.should == params # XXX get this working. there's a : vs '' problem amongst others
- end
-
it "should create the request and outgoing message, and send the outgoing message by email, and redirect to request page when input is good and somebody is logged in" do
session[:user_id] = @user.id
post :new, :info_request => { :public_body_id => @body.id,