Sha256: 717463eeab136152bcc597557f22bb86b2f67b886525cf5b9de2662f914d266a

Contents?: true

Size: 767 Bytes

Versions: 7

Compression:

Stored size: 767 Bytes

Contents

require "test_helper"
require "database/setup"

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.service_url

    image = read_image_variant(variant)
    assert_equal 100, image.width
    assert_equal 67, image.height
  end

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

    image = read_image_variant(variant)
    assert_equal 100, image.width
    assert_equal 67, image.height
    assert_match /Gray/, image.colorspace
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
activestorage_legacy-0.2.1 test/models/variant_test.rb
activestorage_legacy-0.2.0 test/models/variant_test.rb
activestorage_legacy-0.1.3 test/models/variant_test.rb
activestorage_legacy-0.1.2 test/models/variant_test.rb
activestorage_legacy-0.1.1 test/models/variant_test.rb
activestorage_legacy-0.1.1.alpha test/models/variant_test.rb
activestorage_legacy-0.1 test/models/variant_test.rb