From 804ce54e241f99e4e146c8c6ffded5fbb1adc790 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 20 Aug 2012 17:05:37 +0100 Subject: Use find_by_url_title! to raise ActiveRecordNotFound in upload response when no record is found using url_title. Closes #553. --- spec/controllers/request_controller_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) (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 8cadbd238..13dbe4b74 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -1736,6 +1736,10 @@ describe RequestController, "authority uploads a response from the web interface flash[:error].should match(/Please type a message/) end + it 'should 404 for non existent requests' do + lambda{ post :upload_response, :url_title => 'i_dont_exist'}.should raise_error(ActiveRecord::RecordNotFound) + end + # How do I test a file upload in rails? # http://stackoverflow.com/questions/1178587/how-do-i-test-a-file-upload-in-rails it "should let the authority upload a file" do -- cgit v1.2.3