File: epics_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 (66 lines) | stat: -rw-r--r-- 1,524 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# frozen_string_literal: true

require 'spec_helper'

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

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

    it 'returns a paginated response of groups' do
      expect(@epics).to be_a Gitlab::PaginatedResponse
    end
  end

  describe '.epic' do
    before do
      stub_get('/groups/1/epics/2', 'epic')
      Gitlab.epic(1, 2)
    end

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

  describe '.create_epic' do
    before do
      stub_post('/groups/1/epics', 'epic')
      Gitlab.create_epic(1, 'foo', description: 'bar')
    end

    it 'creates the right resource' do
      expect(a_post('/groups/1/epics')
        .with(body: { title: 'foo', description: 'bar' })).to have_been_made
    end
  end

  describe '.edit_epic' do
    before do
      stub_put('/groups/1/epics/2', 'epic')
      Gitlab.edit_epic(1, 2, title: 'mepmep')
    end

    it 'updates the correct resource' do
      expect(a_put('/groups/1/epics/2')
        .with(body: { title: 'mepmep' })).to have_been_made
    end
  end

  describe '.delete_epic' do
    before do
      stub_delete('/groups/1/epics/2', 'epic')
      Gitlab.delete_epic(1, 2)
    end

    it 'deletes the correct resource' do
      expect(a_delete('/groups/1/epics/2')).to have_been_made
    end
  end
end