File: client_spec.rb

package info (click to toggle)
ruby-gitlab 5.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,660 kB
  • sloc: ruby: 12,582; makefile: 7; sh: 4
file content (42 lines) | stat: -rw-r--r-- 1,090 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Client do
  subject(:client) { described_class.new(options) }

  describe '#inspect' do
    subject { client.inspect }

    context 'without private token' do
      let(:options) { { private_token: nil } }

      it { is_expected.not_to include('@private_token=') }
    end

    context 'with a some lengthy private token' do
      let(:options) { { private_token: 'some token' } }

      it { is_expected.to include('@private_token="******oken"') }
    end

    context 'with a known private token' do
      let(:options) { { private_token: 'endpoint' } }

      it { is_expected.to include('@private_token="****oint"') }
      it { is_expected.to include('@endpoint=') }
    end

    context 'with empty private token' do
      let(:options) { { private_token: '' } }

      it { is_expected.to include('@private_token="****"') }
    end

    context 'with short private token' do
      let(:options) { { private_token: 'abcd' } }

      it { is_expected.to include('@private_token="****"') }
    end
  end
end