Sha256: 3d8aaa64ca3d7f46f029aaa157c97ba8fc52dd2fdb36b42162a653723df298da

Contents?: true

Size: 935 Bytes

Versions: 5

Compression:

Stored size: 935 Bytes

Contents

require 'test_helper'

class UrlTest < Imgix::Test
  def test_signing_with_no_params
    path = '/images/demo.png'
    assert_equal 'http://demo.imgix.net/images/demo.png?&s=3c1d676d4daf28c044dd83e8548f834a', client.sign_path(path)
  end

  def test_signing_with_one
    path = '/images/demo.png?w=200'
    assert_equal 'http://demo.imgix.net/images/demo.png?w=200&s=da421114ca238d1f4a927b889f67c34e', client.sign_path(path)
  end

  def test_signing_with_multiple_params
    path = '/images/demo.png?h=200&w=200'
    assert_equal 'http://demo.imgix.net/images/demo.png?h=200&w=200&s=d570a1ecd765470f7b34a69b56718a7a', client.sign_path(path)

    path = '/images/demo.png?w=200&h=200'
    assert_equal 'http://demo.imgix.net/images/demo.png?w=200&h=200&s=00b5cde5c7b8bca8618cb911da4ac379', client.sign_path(path)
  end

private

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
imgix-0.3.3 test/units/url_test.rb
imgix-0.3.2 test/units/url_test.rb
imgix-0.3.1 test/units/url_test.rb
imgix-0.3.0 test/units/url_test.rb
imgix-0.2.1 test/units/url_test.rb