Sha256: eda703ee3e3ed9817c119c0bfb87d273c87147c0814b2693738a89c3c6f1ccf8
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
require 'spec_helper' describe "urls" do def job_should_match(array) Dragonfly::Response.should_receive(:new).with( satisfy{|job| job.to_a == array }, instance_of(Hash) ).and_return(double('response', :to_response => [200, {'content-type' => 'text/plain'}, ["OK"]])) end let (:app) { test_app.configure{ processor(:thumb){} verify_urls false } } it "works with old marshalled urls (including with tildes in them)" do app.allow_legacy_urls = true url = "/BAhbBlsHOgZmSSIIPD4~BjoGRVQ" job_should_match [["f", "<>?"]] response = request(app, url) end it "blows up if it detects bad objects" do app.allow_legacy_urls = true url = "/BAhvOhpEcmFnb25mbHk6OlRlbXBPYmplY3QIOgpAZGF0YUkiCWJsYWgGOgZFVDoXQG9yaWdpbmFsX2ZpbGVuYW1lMDoKQG1ldGF7AA" Dragonfly::Job.should_not_receive(:from_a) response = request(app, url) response.status.should == 404 end it "works with the '%2B' character" do url = "/W1siZiIsIjIwMTIvMTEvMDMvMTdfMzhfMDhfNTc4X19NR181ODk5Xy5qcGciXSxbInAiLCJ0aHVtYiIsIjQ1MHg0NTA%2BIl1d/_MG_5899+.jpg" job_should_match [["f", "2012/11/03/17_38_08_578__MG_5899_.jpg"], ["p", "thumb", "450x450>"]] response = request(app, url) end it "works when '%2B' has been converted to + (e.g. with nginx)" do url = "/W1siZiIsIjIwMTIvMTEvMDMvMTdfMzhfMDhfNTc4X19NR181ODk5Xy5qcGciXSxbInAiLCJ0aHVtYiIsIjQ1MHg0NTA+Il1d/_MG_5899+.jpg" job_should_match [["f", "2012/11/03/17_38_08_578__MG_5899_.jpg"], ["p", "thumb", "450x450>"]] response = request(app, url) end it "works with potentially tricky url characters for the url" do url = app.fetch('uid []=~/+').url(:name => 'name []=~/+') url.should =~ %r(^/[\w-]+/name%20%5B%5D%3D%7E%2F%2B$) job_should_match [["f", "uid []=~/+"]] response = request(app, url) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dragonfly-1.4.1 | spec/functional/urls_spec.rb |