diff options
author | francis <francis> | 2008-03-15 04:19:03 +0000 |
---|---|---|
committer | francis <francis> | 2008-03-15 04:19:03 +0000 |
commit | 0a423eae84d6c2b123a50d2c7e8195a873aa224a (patch) | |
tree | 0b1a4e8832e63dbd7389bb9f5de5f94d518415f3 /spec/controllers/request_controller_spec.rb | |
parent | cb40d0436a2e19beaad0ec2715da97e9b8086527 (diff) |
Add tests for broken case of saving info request or user when there is existing one with same title/name.
Fix the bug, which was in function that makes url_title/url_name.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index d8a0466ba..faaffb709 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -128,6 +128,31 @@ describe RequestController, "when creating a new request" do :submitted_new_request => 1 response.should render_template('new') end + + it "should let you submit another request with the same title" 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." }, + :submitted_new_request => 1 + + 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 sensible letter. It is too long to be boring." }, + :submitted_new_request => 1 + + ir_array = InfoRequest.find(:all, :conditions => ["title = ?", "Why is your quango called Geraldine?"], :order => "id") + ir_array.size.should == 2 + + ir = ir_array[0] + ir2 = ir_array[1] + + ir.url_title.should_not == ir2.url_title + + response.should redirect_to(:controller => 'request', :action => 'show', :url_title => ir2.url_title) + end + end describe RequestController, "when viewing an individual response" do |