aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-01-04 15:27:18 +0000
committerfrancis <francis>2008-01-04 15:27:18 +0000
commitf30b34ecfd7c9916ee9b9034d5c4cd4cc7b42746 (patch)
treecee22b79f864fc769352fb9fac6613a8dbe03fc3 /spec/controllers/request_controller_spec.rb
parent26c033ba9e7cc0211881d0e388d05423567a81e4 (diff)
On second thoughts, use hidden field to mark submission of the form.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index a6668c7e1..94892081c 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -101,16 +101,17 @@ describe RequestController, "when creating a new request" do
end
it "should give an error and render 'new' template when a summary isn't given" do
- post :new, :info_request => { :public_body_id => public_bodies(:geraldine_public_body).id
- },
- :outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." }
+ post :new, :info_request => { :public_body_id => public_bodies(:geraldine_public_body).id },
+ :outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." },
+ :submitted_new_request => 1
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 => 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." }
+ :outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." },
+ :submitted_new_request => 1
}
post :new, params
# XXX yeuch - no other easy way of getting the token so we can check
@@ -127,7 +128,8 @@ describe RequestController, "when creating a new request" do
session[:user_id] = users(:bob_smith_user).id
post :new, :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." }
+ :outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." },
+ :submitted_new_request => 1
ir_array = InfoRequest.find(:all, :conditions => ["title = ?", "Why is your quango called Geraldine?"])
ir_array.size.should == 1
ir = ir_array[0]
@@ -140,7 +142,8 @@ describe RequestController, "when creating a new request" do
it "should give an error if the same request is submitted twice" do
post :new, :info_request => { :public_body_id => info_requests(:fancy_dog_request).public_body_id,
:title => info_requests(:fancy_dog_request).title},
- :outgoing_message => { :body => info_requests(:fancy_dog_request).outgoing_messages[0].body}
+ :outgoing_message => { :body => info_requests(:fancy_dog_request).outgoing_messages[0].body},
+ :submitted_new_request => 1
response.should render_template('new')
end
end