spec/dragonfly/job/fetch_url_spec.rb in dragonfly-1.1.3 vs spec/dragonfly/job/fetch_url_spec.rb in dragonfly-1.1.4

- old
+ new

@@ -1,6 +1,7 @@ require 'spec_helper' +require 'base64' describe Dragonfly::Job::FetchUrl do let (:app) { test_app } let (:job) { Dragonfly::Job.new(app) } @@ -158,9 +159,21 @@ it "accepts standard base64 encoded data uris" do job.fetch_url!("data:text/plain;base64,aGVsbG8=\n") job.data.should == 'hello' job.mime_type.should == 'text/plain' job.ext.should == 'txt' + end + + it "accepts long base64 encoded data uris with newline" do + str = 'hello' * 10 + job.fetch_url!("data:text/plain;base64,#{Base64.encode64(str)}") + job.data.should == str + end + + it "accepts long base64 encoded data uris without newline" do + str = 'hello' * 10 + job.fetch_url!("data:text/plain;base64,#{Base64.strict_encode64(str)}") + job.data.should == str end it "doesn't accept other data uris" do expect { job.fetch_url!("data:text/html;charset=utf-8,<stuff />").apply