1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activestorage/test/controllers/variants_controller_test.rb

24 lines
649 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-07-21 17:12:29 -04:00
require "test_helper"
require "database/setup"
2017-07-27 16:15:38 -04:00
class ActiveStorage::VariantsControllerTest < ActionDispatch::IntegrationTest
2017-07-21 17:12:29 -04:00
setup do
@blob = create_image_blob filename: "racecar.jpg"
2017-07-21 17:12:29 -04:00
end
test "showing variant inline" do
2017-07-27 16:15:38 -04:00
get rails_blob_variation_url(
2017-07-21 17:12:29 -04:00
filename: @blob.filename,
signed_blob_id: @blob.signed_id,
2017-07-27 16:15:38 -04:00
variation_key: ActiveStorage::Variation.encode(resize: "100x100"))
2017-07-21 17:12:29 -04:00
assert_redirected_to(/racecar.jpg\?.*disposition=inline/)
image = read_image_variant(@blob.variant(resize: "100x100"))
assert_equal 100, image.width
assert_equal 67, image.height
2017-07-21 17:12:29 -04:00
end
end