Sha256: e1a7249e87b67bfed3035eebfb65a63d067e3273dea9f9f76a3a2949afbebd57
Contents?: true
Size: 904 Bytes
Versions: 30
Compression:
Stored size: 904 Bytes
Contents
require_relative "../spec_helper" if Rack.release < '1.6' warn "Rack #{Rack.release} used, skipping disallow_file_uploads plugin test" else describe "disallow_file_uploads plugin" do it "disallows the uploading of files" do app do |r| r.params['foo'][:tempfile].read end request_body = StringIO.new("------WebKitFormBoundarymwHIM9XjTTVHn3YP\r\nContent-Disposition: form-data; name=\"foo\"; filename=\"bar.txt\"\r\nContent-Type: text/plain\r\n\r\nfoo\n\r\n------WebKitFormBoundarymwHIM9XjTTVHn3YP--\r\n") h = { 'rack.input'=>request_body, 'CONTENT_TYPE'=>'multipart/form-data; boundary=----WebKitFormBoundarymwHIM9XjTTVHn3YP', 'CONTENT_LENGTH'=>'184', 'REQUEST_METHOD'=>'POST' } body(h.dup).must_equal "foo\n" app.plugin :disallow_file_uploads proc{body(h.dup)}.must_raise Roda::RodaPlugins::DisallowFileUploads::Error end end end
Version data entries
30 entries across 30 versions & 1 rubygems