aboutsummaryrefslogtreecommitdiffstats
path: root/test/models/variant_test.rb
blob: c7ff0d77e1e9642cac1ef2f00a038f8f5d7df06b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require "test_helper"
require "database/setup"
require "active_storage/variant"

class ActiveStorage::VariantTest < ActiveSupport::TestCase
  setup do
    @blob = create_image_blob filename: "racecar.jpg"
  end

  test "resized variation" do
    variant = @blob.variant(resize: "100x100").processed

    assert_match /racecar.jpg/, variant.url
    assert_same_image "racecar-100x100.jpg", variant
  end

  test "resized and monochrome variation" do
    variant = @blob.variant(resize: "100x100", monochrome: true).processed

    assert_match /racecar.jpg/, variant.url
    assert_same_image "racecar-100x100-monochrome.jpg", variant
  end
end