diff options
Diffstat (limited to 'test/variation_test.rb')
-rw-r--r-- | test/variation_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/variation_test.rb b/test/variation_test.rb new file mode 100644 index 0000000000..3b05095292 --- /dev/null +++ b/test/variation_test.rb @@ -0,0 +1,16 @@ +require "test_helper" +require "database/setup" +require "active_storage/variant" + +class ActiveStorage::VariationTest < ActiveSupport::TestCase + test "square variation" do + blob = ActiveStorage::Blob.create_after_upload! \ + io: File.open(File.expand_path("../fixtures/files/racecar.jpg", __FILE__)), filename: "racecar.jpg", content_type: "image/jpeg" + + variation_key = ActiveStorage::Variant.encode_key(resize: "500x500") + + variant = ActiveStorage::Variant.lookup(blob_key: blob.key, variation_key: variation_key) + + assert_match /racecar.jpg/, variant.url + end +end |