Sha256: 4e5c8c6ea2660f295145a38a4ee80b29ec6dee744e1bf3217beb66c3c9fba202

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require "spec_helper"

RSpec.describe Doorkeeper::OAuth::Authorization::URIBuilder do
  describe ".uri_with_query" do
    it "returns the uri with query" do
      uri = described_class.uri_with_query "http://example.com/", parameter: "value"
      expect(uri).to eq("http://example.com/?parameter=value")
    end

    it "rejects nil values" do
      uri = described_class.uri_with_query "http://example.com/", parameter: ""
      expect(uri).to eq("http://example.com/?")
    end

    it "preserves original query parameters" do
      uri = described_class.uri_with_query "http://example.com/?query1=value", parameter: "value"
      expect(uri).to match(/query1=value/)
      expect(uri).to match(/parameter=value/)
    end
  end

  describe ".uri_with_fragment" do
    it "returns uri with parameters as fragments" do
      uri = described_class.uri_with_fragment "http://example.com/", parameter: "value"
      expect(uri).to eq("http://example.com/#parameter=value")
    end

    it "preserves original query parameters" do
      uri = described_class.uri_with_fragment "http://example.com/?query1=value1", parameter: "value"
      expect(uri).to eq("http://example.com/?query1=value1#parameter=value")
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
doorkeeper-mongodb-5.3.0 spec/lib/oauth/authorization/uri_builder_spec.rb
doorkeeper-mongodb-5.2.3 spec/lib/oauth/authorization/uri_builder_spec.rb
doorkeeper-sequel-2.4.0 spec/lib/oauth/authorization/uri_builder_spec.rb
doorkeeper-mongodb-5.2.2 spec/lib/oauth/authorization/uri_builder_spec.rb
doorkeeper-sequel-2.3.0 spec/lib/oauth/authorization/uri_builder_spec.rb