Sha256: fae96604c97fc54bf8534d5ffb83b7c9aa8b3a823f029467381c5f91472325c5

Contents?: true

Size: 751 Bytes

Versions: 8

Compression:

Stored size: 751 Bytes

Contents

# frozen_string_literal: true

module NulogySSO
  RSpec.describe OriginRedirector do
    let(:mock_login_uri) { NulogySSO::sso_config.login_uri }

    describe "#authentication_redirect_uri" do
      it "appends the url escaped origin to the redirect uri" do
        previous_url = "https://example.com/path?foo=bar&specialParam%5Babc%5D=1"

        result = subject.authentication_redirect_uri(previous_url)

        expect(result).to eq("#{mock_login_uri}?origin=https%3A%2F%2Fexample.com%2Fpath%3Ffoo%3Dbar%26specialParam%255Babc%255D%3D1")
      end

      it "omits the origin when the previous uri is missing" do
        result = subject.authentication_redirect_uri(nil)

        expect(result).to eq(mock_login_uri)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nulogy_sso-2.6.0 spec/unit/services/nulogy_sso/origin_redirector_spec.rb
nulogy_sso-2.5.1 spec/unit/services/nulogy_sso/origin_redirector_spec.rb
nulogy_sso-2.5.0 spec/unit/services/nulogy_sso/origin_redirector_spec.rb
nulogy_sso-2.4.0 spec/unit/services/nulogy_sso/origin_redirector_spec.rb
nulogy_sso-2.3.1 spec/unit/services/nulogy_sso/origin_redirector_spec.rb
nulogy_sso-2.3.0 spec/unit/services/nulogy_sso/origin_redirector_spec.rb
nulogy_sso-2.2.0 spec/unit/services/nulogy_sso/origin_redirector_spec.rb
nulogy_sso-2.1.3 spec/unit/services/nulogy_sso/origin_redirector_spec.rb