aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test/models
diff options
context:
space:
mode:
authorJulik Tarkhanov <me@julik.nl>2018-12-30 17:56:22 +0100
committerGeorge Claghorn <george.claghorn@gmail.com>2018-12-30 11:56:22 -0500
commite5f4162b6178489181e3d7e7163ac12b7e0efc9d (patch)
tree75dea44e5e9bb7d87eeeeb2733666f5831a2344c /activestorage/test/models
parenta796b993ad3717f9a0b3d5be070311ab7a0c95ba (diff)
downloadrails-e5f4162b6178489181e3d7e7163ac12b7e0efc9d.tar.gz
rails-e5f4162b6178489181e3d7e7163ac12b7e0efc9d.tar.bz2
rails-e5f4162b6178489181e3d7e7163ac12b7e0efc9d.zip
Make Active Storage blob keys lowercase
Accommodate case-insensitive filesystems and database collations.
Diffstat (limited to 'activestorage/test/models')
-rw-r--r--activestorage/test/models/blob_test.rb4
-rw-r--r--activestorage/test/models/variant_test.rb2
2 files changed, 5 insertions, 1 deletions
diff --git a/activestorage/test/models/blob_test.rb b/activestorage/test/models/blob_test.rb
index 1503f5fc50..54cf9e2b8a 100644
--- a/activestorage/test/models/blob_test.rb
+++ b/activestorage/test/models/blob_test.rb
@@ -47,6 +47,10 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase
assert_equal "text/csv", blob.content_type
end
+ test "create after upload generates a 28-character base36 key" do
+ assert_match(/^[a-z0-9]{28}$/, create_blob.key)
+ end
+
test "image?" do
blob = create_file_blob filename: "racecar.jpg"
assert_predicate blob, :image?
diff --git a/activestorage/test/models/variant_test.rb b/activestorage/test/models/variant_test.rb
index 4f88440e54..012aee3cc9 100644
--- a/activestorage/test/models/variant_test.rb
+++ b/activestorage/test/models/variant_test.rb
@@ -150,7 +150,7 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase
test "service_url doesn't grow in length despite long variant options" do
blob = create_file_blob(filename: "racecar.jpg")
variant = blob.variant(font: "a" * 10_000).processed
- assert_operator variant.service_url.length, :<, 726
+ assert_operator variant.service_url.length, :<, 730
end
test "works for vips processor" do