Sha256: 96dd16c7ce4dfb876d9a8e801235d625454e897452264f60e0bd1ccf3529f67d

Contents?: true

Size: 964 Bytes

Versions: 14

Compression:

Stored size: 964 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class DeviseJwtAuth::UrlTest < ActiveSupport::TestCase
  describe 'DeviseJwtAuth::Url#generate' do
    test 'URI fragment should appear at the end of URL with repeat of query params' do
      params = { client_id: 123 }
      url = 'http://example.com#fragment'
      assert_equal DeviseJwtAuth::Url.send(:generate, url, params), 'http://example.com?client_id=123#fragment?client_id=123'
    end

    describe 'with existing query params' do
      test 'should preserve existing query params' do
        url = 'http://example.com?a=1'
        assert_equal DeviseJwtAuth::Url.send(:generate, url), 'http://example.com?a=1'
      end

      test 'should marge existing query params with new ones' do
        params = { client_id: 123 }
        url = 'http://example.com?a=1'
        assert_equal DeviseJwtAuth::Url.send(:generate, url, params), 'http://example.com?a=1&client_id=123'
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
devise_jwt_auth722-0.1.7 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth7-0.1.7 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.4.1 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.4.0 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.3.0 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.2.0 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.1.7 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.1.6 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.1.5 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.1.4 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.1.3 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.1.2 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.1.1 test/lib/devise_jwt_auth/url_test.rb
devise_jwt_auth-0.1.0 test/lib/devise_jwt_auth/url_test.rb