aboutsummaryrefslogblamecommitdiffstats
path: root/test/variant_test.rb
blob: bc3a1fef9076a650347908f77180f0662d6b9dd7 (plain) (tree)
1
2
3
4
5



                                
                                                          








                                                                                  
 

                                                                                                

     
require "test_helper"
require "database/setup"
require "active_storage/variant"

class ActiveStorage::VariantTest < ActiveSupport::TestCase
  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

  test "resized and monochrome variation" do
    assert_match /racecar.jpg/, @blob.variant(resize: "100x100", monochrome: true).processed.url
  end
end