Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove the questionmark filename test for real file

  • Loading branch information...
commit ed5cd9f192953278a27efa82976c21d78cea9e8f 1 parent bdfeebd
@sikachu sikachu authored
View
BIN  test/fixtures/question?mark.png
Deleted file not rendered
View
36 test/storage/s3_live_test.rb
@@ -99,42 +99,6 @@ class S3LiveTest < Test::Unit::TestCase
end
end
- context "An attachment that uses S3 for storage and has a question mark in file name" do
- setup do
- rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" },
- :storage => :s3,
- :bucket => ENV["S3_BUCKET"],
- :s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "fixtures", "s3.yml"))
-
- Dummy.delete_all
- @dummy = Dummy.new
- @dummy.avatar = File.new(File.join(File.dirname(__FILE__), '..', 'fixtures', 'question?mark.png'), 'rb')
- @dummy.save
- end
-
- should "return an unescaped version for path" do
- assert_match /.+\/question\?mark\.png/, @dummy.avatar.path
- end
-
- should "return an escaped version for url" do
- assert_match /.+\/question%3Fmark\.png/, @dummy.avatar.url
- end
-
- should "be accessible" do
- assert_success_response @dummy.avatar.url
- end
-
- should "be accessible with an expiring url" do
- assert_success_response @dummy.avatar.expiring_url
- end
-
- should "be destroyable" do
- url = @dummy.avatar.url
- @dummy.destroy
- assert_not_found_response url
- end
- end
-
context "An attachment that uses S3 for storage and uses AES256 encryption" do
setup do
rebuild_model :styles => { :thumb => "100x100", :square => "32x32#" },
View
26 test/storage/s3_test.rb
@@ -231,6 +231,32 @@ def teardown
end
end
+ context "An attachment that uses S3 for storage and has a question mark in file name" do
+ setup do
+ rebuild_model :styles => { :large => ['500x500#', :jpg] },
+ :storage => :s3,
+ :bucket => "bucket",
+ :s3_credentials => {
+ 'access_key_id' => "12345",
+ 'secret_access_key' => "54321"
+ }
+
+ file = StringIO.new(".")
+ file.original_filename = "question?mark.png"
+ @dummy = Dummy.new
+ @dummy.avatar = file
+ @dummy.save
+ end
+
+ should "return an unescaped version for path" do
+ assert_match /.+\/question\?mark\.png/, @dummy.avatar.path
+ end
+
+ should "return an escaped version for url" do
+ assert_match /.+\/question%3Fmark\.png/, @dummy.avatar.url
+ end
+ end
+
context "" do
setup do
rebuild_model :storage => :s3,
Please sign in to comment.
Something went wrong with that request. Please try again.