File: templates_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 (125 lines) | stat: -rw-r--r-- 3,669 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Client do
  describe '.dockerfile_templates' do
    before do
      stub_get('/templates/dockerfiles', 'dockerfile_templates')
      @dockerfile_templates = Gitlab.dockerfile_templates
    end

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

    it 'returns a paginated response of dockerfile templates' do
      expect(@dockerfile_templates).to be_a Gitlab::PaginatedResponse
    end
  end

  describe '.dockerfile_template' do
    before do
      stub_get('/templates/dockerfiles/Binary', 'dockerfile_project_template')
      @dockerfile_template = Gitlab.dockerfile_template('Binary')
    end

    it 'gets the correct resource' do
      expect(a_get('/templates/dockerfiles/Binary')).to have_been_made
    end

    it 'returns the correct information about the dockerfile template' do
      expect(@dockerfile_template.name).to eq 'Binary'
    end
  end

  describe '.gitignore_templates' do
    before do
      stub_get('/templates/gitignores', 'gitignore_templates')
      @gitignore_templates = Gitlab.gitignore_templates
    end

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

    it 'returns a paginated response of gitignore templates' do
      expect(@gitignore_templates).to be_a Gitlab::PaginatedResponse
    end
  end

  describe '.gitignore_template' do
    before do
      stub_get('/templates/gitignores/Ruby', 'gitignore_template')
      @gitignore_template = Gitlab.gitignore_template('Ruby')
    end

    it 'gets the correct resource' do
      expect(a_get('/templates/gitignores/Ruby')).to have_been_made
    end

    it 'returns the correct information about the gitignore template' do
      expect(@gitignore_template.name).to eq 'Ruby'
    end
  end

  describe '.gitlab_ci_yml_templates' do
    before do
      stub_get('/templates/gitlab_ci_ymls', 'gitlab_ci_yml_templates')
      @gitlab_ci_yml_templates = Gitlab.gitlab_ci_yml_templates
    end

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

    it 'returns a paginated response of gitlab_ci_yml templates' do
      expect(@gitlab_ci_yml_templates).to be_a Gitlab::PaginatedResponse
    end
  end

  describe '.gitlab_ci_yml_template' do
    before do
      stub_get('/templates/gitlab_ci_ymls/Ruby', 'gitlab_ci_yml_template')
      @gitlab_ci_yml_template = Gitlab.gitlab_ci_yml_template('Ruby')
    end

    it 'gets the correct resource' do
      expect(a_get('/templates/gitlab_ci_ymls/Ruby')).to have_been_made
    end

    it 'returns the correct information about the gitlab_ci_yml template' do
      expect(@gitlab_ci_yml_template.name).to eq 'Ruby'
    end
  end

  describe '.license_templates' do
    before do
      stub_get('/templates/licenses', 'license_templates')
      @license_templates = Gitlab.license_templates
    end

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

    it 'returns a paginated response of license templates' do
      expect(@license_templates).to be_a Gitlab::PaginatedResponse
    end
  end

  describe '.license_template' do
    before do
      stub_get('/templates/licenses/mit', 'license_template')
      @license_template = Gitlab.license_template('mit')
    end

    it 'gets the correct resource' do
      expect(a_get('/templates/licenses/mit')).to have_been_made
    end

    it 'returns the correct information about the license template' do
      expect(@license_template.key).to eq 'mit'
    end
  end
end