File: keys_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 (37 lines) | stat: -rw-r--r-- 960 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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Client do
  describe '.key' do
    before do
      stub_get('/keys/1', 'key')
      @key = Gitlab.key(1)
    end

    it 'gets the correct resource' do
      expect(a_get('/keys/1')).to have_been_made
    end

    it 'returns information about a key' do
      expect(@key.id).to eq(1)
      expect(@key.title).to eq('narkoz@helium')
    end
  end

  describe '.key_by_fingerprint' do
    before do
      stub_get('/keys?fingerprint=9f:70:33:b3:50:4d:9a:a3:ef:ea:13:9b:87:0f:7f:7e', 'key')
      @key = Gitlab.key_by_fingerprint('9f:70:33:b3:50:4d:9a:a3:ef:ea:13:9b:87:0f:7f:7e')
    end

    it 'gets the correct resource' do
      expect(a_get('/keys?fingerprint=9f:70:33:b3:50:4d:9a:a3:ef:ea:13:9b:87:0f:7f:7e')).to have_been_made
    end

    it 'returns information about a key' do
      expect(@key.id).to eq(1)
      expect(@key.title).to eq('narkoz@helium')
    end
  end
end