aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration/parameter_stripping_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-06-11 14:41:23 +0100
committerLouise Crow <louise.crow@gmail.com>2015-06-11 14:41:23 +0100
commited049c36463124d631132549bd49e46dedb9544a (patch)
treefcfbbc15daa97efdefaa411635ce178b29a52f2c /spec/integration/parameter_stripping_spec.rb
parent3efe2f333a9b143e88556c0aeedb534090eb41d3 (diff)
parent090531bf2d2b763e5bb281658e91b58905912130 (diff)
Merge branch 'sanitize-utf8' into develop
Diffstat (limited to 'spec/integration/parameter_stripping_spec.rb')
-rw-r--r--spec/integration/parameter_stripping_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/integration/parameter_stripping_spec.rb b/spec/integration/parameter_stripping_spec.rb
new file mode 100644
index 000000000..b910062a9
--- /dev/null
+++ b/spec/integration/parameter_stripping_spec.rb
@@ -0,0 +1,24 @@
+# -*- encoding : utf-8 -*-
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe "When handling bad requests" do
+
+ if RUBY_VERSION.to_f >= 1.9
+
+ it 'should return a 404 for GET requests to a malformed request URL' do
+ get 'request/228%85'
+ response.status.should == 404
+ end
+
+ it 'should redirect a bad UTF-8 POST to a malformed attachment URL' do
+ info_request = FactoryGirl.create(:info_request_with_incoming_attachments)
+ incoming_message = info_request.incoming_messages.first
+ data = { :excerpt => "something\xA3\xA1" }
+ post "/en/request/#{info_request.id}/response/#{incoming_message.id}/attach/2/interesting.pdf/trackback", data
+ response.status.should == 303
+ response.should redirect_to "/en/request/#{info_request.url_title}#incoming-#{incoming_message.id}"
+ end
+
+ end
+
+end