aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_helper.rb5
-rw-r--r--test/variation_test.rb15
2 files changed, 13 insertions, 7 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index af379ad35a..e98b6e0afc 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -15,7 +15,6 @@ rescue Errno::ENOENT
{}
end
-
require "active_storage/service/disk_service"
require "tmpdir"
ActiveStorage::Blob.service = ActiveStorage::Service::DiskService.new(root: Dir.mktmpdir("active_storage_tests"))
@@ -24,8 +23,8 @@ ActiveStorage::Service.logger = ActiveSupport::Logger.new(STDOUT)
require "active_storage/verified_key_with_expiration"
ActiveStorage::VerifiedKeyWithExpiration.verifier = ActiveSupport::MessageVerifier.new("Testing")
-require "active_storage/variant"
-ActiveStorage::Variant.verifier = ActiveSupport::MessageVerifier.new("Testing")
+require "active_storage/variation"
+ActiveStorage::Variation.verifier = ActiveSupport::MessageVerifier.new("Testing")
class ActiveSupport::TestCase
private
diff --git a/test/variation_test.rb b/test/variation_test.rb
index 8e569f908c..d138682005 100644
--- a/test/variation_test.rb
+++ b/test/variation_test.rb
@@ -3,10 +3,17 @@ 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"
+ setup do
+ @blob = ActiveStorage::Blob.create_after_upload! \
+ filename: "racecar.jpg", content_type: "image/jpeg",
+ io: File.open(File.expand_path("../fixtures/files/racecar.jpg", __FILE__))
+ end
+
+ test "resized variation" do
+ assert_match /racecar.jpg/, @blob.variant(resize: "100x100").processed.url
+ end
- assert_match /racecar.jpg/, blob.variant(resize: "100x100").processed.url
+ test "resized and monochrome variation" do
+ assert_match /racecar.jpg/, @blob.variant(resize: "100x100", monochrome: true).processed.url
end
end