Sha256: 2f5d3b2d12933621ebb9c0b30fd076ce3c460c6319a3c1b946c107dfd4a3dd14

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'test_helper'

class UrlTest < Imgix::Test
  DEMO_IMAGE_PATH = '/images/demo.png'

  def test_signing_with_no_params
    path = client.path(DEMO_IMAGE_PATH)

    assert_equal 'https://demo.imgix.net/images/demo.png?s=2c7c157eaf23b06a0deb2f60b81938c4', path.to_url
  end

  def test_signing_with_one
    path = client.path(DEMO_IMAGE_PATH)
    path.width = 200

    assert_equal 'https://demo.imgix.net/images/demo.png?w=200&s=da421114ca238d1f4a927b889f67c34e', path.to_url
  end

  def test_signing_with_multiple_params
    path = client.path(DEMO_IMAGE_PATH)
    path.height = 200
    path.width = 200
    assert_equal 'https://demo.imgix.net/images/demo.png?h=200&w=200&s=d570a1ecd765470f7b34a69b56718a7a', path.to_url

    path = client.path(DEMO_IMAGE_PATH)
    path.width = 200
    path.height = 200
    assert_equal 'https://demo.imgix.net/images/demo.png?w=200&h=200&s=00b5cde5c7b8bca8618cb911da4ac379', path.to_url
  end

private

  def client
    @client ||= Imgix::Client.new(host: 'demo.imgix.net', secure_url_token: '10adc394', include_library_param: false)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
imgix-3.2.1 test/units/url_test.rb
imgix-3.2.0 test/units/url_test.rb
imgix-3.1.1 test/units/url_test.rb
imgix-3.1.0 test/units/url_test.rb
imgix-3.0.0 test/units/url_test.rb
imgix-2.1.0 test/units/url_test.rb
imgix-2.0.0 test/units/url_test.rb
imgix-1.2.2 test/units/url_test.rb