Sha256: 136e09f25eeab4625b3fa15e123f22e3eb693a346a73821d2f3a0f65cdaba5fb

Contents?: true

Size: 974 Bytes

Versions: 10

Compression:

Stored size: 974 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class DeviseTokenAuth::UrlTest < ActiveSupport::TestCase
  describe 'DeviseTokenAuth::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 DeviseTokenAuth::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 DeviseTokenAuth::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 DeviseTokenAuth::Url.send(:generate, url, params), 'http://example.com?a=1&client_id=123'
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
devise_token_auth-1.2.4 test/lib/devise_token_auth/url_test.rb
devise_token_auth-1.2.2 test/lib/devise_token_auth/url_test.rb
devise_token_auth-1.2.1 test/lib/devise_token_auth/url_test.rb
devise_token_auth-1.2.0 test/lib/devise_token_auth/url_test.rb
devise_token_auth-1.1.5 test/lib/devise_token_auth/url_test.rb
sidecar_token_auth-1.0.1 test/lib/devise_token_auth/url_test.rb
devise_token_auth-1.1.4 test/lib/devise_token_auth/url_test.rb
devise_token_auth_multitenancy-1.1.3.2 test/lib/devise_token_auth/url_test.rb
devise_token_auth_multitenancy-1.1.3.1 test/lib/devise_token_auth/url_test.rb
devise_token_auth_multitenancy-1.1.3.alpha1 test/lib/devise_token_auth/url_test.rb