aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration/parameter_stripping_spec.rb
blob: 7e3c0adc2700e8c4388810e2bf093252c3f17705 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "When handling bad requests" do

    if RUBY_VERSION == '1.9.3'

        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