Sha256: 58db653f3702d19640fc6b838ec728ddf1b0ecf0ebb305e7bf78e45a03dbbb60

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require 'bundler/anonymizable_uri'

describe Bundler::AnonymizableURI do
  let(:anonymizable_uri) { Bundler::AnonymizableURI.new(original_uri) }

  describe "#without_credentials" do
    context "when the original URI has no credentials" do
      let(:original_uri) { URI('https://rubygems.org') }

      it "returns the original URI" do
        expect(anonymizable_uri.without_credentials).to eq(original_uri)
      end
    end

    context "when the original URI has a username and password" do
      let(:original_uri) { URI("https://username:password@gems.example.com") }

      it "returns the URI without username and password" do
        expect(anonymizable_uri.without_credentials).to eq(URI("https://gems.example.com"))
      end
    end

    context "when the original URI has only a username" do
      let(:original_uri) { URI("https://SeCrEt-ToKeN@gem.fury.io/me/") }

      it "returns the URI without username and password" do
        expect(anonymizable_uri.without_credentials).to eq(URI("https://gem.fury.io/me/"))
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bundler-1.7.15 spec/bundler/anonymizable_uri_spec.rb
bundler-1.7.14 spec/bundler/anonymizable_uri_spec.rb
bundler-1.7.13 spec/bundler/anonymizable_uri_spec.rb
bundler-1.7.12 spec/bundler/anonymizable_uri_spec.rb
bundler-1.7.11 spec/bundler/anonymizable_uri_spec.rb
bundler-1.7.10 spec/bundler/anonymizable_uri_spec.rb
bundler-1.7.9 spec/bundler/anonymizable_uri_spec.rb
bundler-1.7.8 spec/bundler/anonymizable_uri_spec.rb