File: cacheable_spec.rb

package info (click to toggle)
r10k 5.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,228 kB
  • sloc: ruby: 18,180; makefile: 10; sh: 1
file content (23 lines) | stat: -rw-r--r-- 664 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'spec_helper'
require 'r10k/util/cacheable'

RSpec.describe R10K::Util::Cacheable do

  subject { Object.new.extend(R10K::Util::Cacheable) }

  describe "dirname sanitization" do
    let(:input) { 'https://some/git/remote' }

    it 'sanitizes URL to directory name' do
      expect(subject.sanitized_dirname(input)).to eq('https---some-git-remote')
    end

    context 'with username and password' do
      let(:input) { 'https://"user:pa$$w0rd:@authenticated/git/remote' }

      it 'sanitizes authenticated URL to directory name' do
        expect(subject.sanitized_dirname(input)).to eq('https---authenticated-git-remote')
      end
    end
  end
end