Codebase list ruby-gitlab / 24b7079
Update upstream source from tag 'upstream/4.5.0' Update to upstream version '4.5.0' with Debian dir 394f0988dbff44ce1c33ef94949f7225423268a4 Cédric Boutillier 5 years ago
219 changed file(s) with 1219 addition(s) and 7259 deletion(s). Raw diff Collapse all Expand all
+0
-8
.travis.yml less more
0 language: ruby
1 rvm:
2 - 2.0
3 - 2.1
4 - 2.2
5 - 2.3
6 - 2.4.0
7 before_install: gem update bundler
0 ## Change Log
1
2 ### Unreleased
0 ## CHANGELOG
1
2 ### Newer releases
3
4 Please see: https://github.com/NARKOZ/gitlab/releases
35
46 ### 4.2.0 (13/07/2017)
57 - Use `url_encode` in all `Commit` resources (@grodowski)
00 # Gitlab
11
2 [![Build Status](https://img.shields.io/travis/NARKOZ/gitlab.svg?style=flat)](https://travis-ci.org/NARKOZ/gitlab)
3 [![Code Climate](https://img.shields.io/codeclimate/github/NARKOZ/gitlab.svg?style=flat)](https://codeclimate.com/github/NARKOZ/gitlab)
4 [![Inline docs](http://inch-ci.org/github/NARKOZ/gitlab.svg?style=flat)](https://inch-ci.org/github/NARKOZ/gitlab)
5 [![Gem version](https://img.shields.io/gem/v/gitlab.svg?style=flat)](https://rubygems.org/gems/gitlab)
6 [![License](https://img.shields.io/badge/license-BSD-red.svg?style=flat)](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt)
2 [![Build Status](https://img.shields.io/travis/NARKOZ/gitlab.svg)](https://travis-ci.org/NARKOZ/gitlab)
3 [![Code Climate](https://img.shields.io/codeclimate/maintainability/NARKOZ/gitlab.svg)](https://codeclimate.com/github/NARKOZ/gitlab)
4 [![Inline docs](http://inch-ci.org/github/NARKOZ/gitlab.svg)](https://inch-ci.org/github/NARKOZ/gitlab)
5 [![Gem version](https://img.shields.io/gem/v/gitlab.svg)](https://rubygems.org/gems/gitlab)
6 [![License](https://img.shields.io/badge/license-BSD-red.svg)](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt)
77
88 [website](http://narkoz.github.io/gitlab) |
99 [documentation](http://rubydoc.info/gems/gitlab/frames) |
1010 [gitlab-live](https://github.com/NARKOZ/gitlab-live)
1111
12 Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ce/api/README.html).
13 As of version `4.0.0` this gem will only support Ruby 2.0+ and Gitlab API v4.
12 Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ce/api/README.html).
13 As of version `4.0.0` this gem only supports Ruby 2.0+ and Gitlab API v4.
1414
1515 ## Installation
1616
2525 ```ruby
2626 gem 'gitlab'
2727 # gem 'gitlab', github: 'NARKOZ/gitlab'
28 ```
29
30 Mac OS users can install using Homebrew:
31
32 ```sh
33 brew install gitlab-gem
2834 ```
2935
3036 ## Usage
174180
175181 ## Development
176182
183 ### With a dockerized Gitlab instance
184
185 ```shell
186 docker-compose up -d gitlab # Will start the gitlab instance in the background (approx. 3 minutes)
187 ```
188
189 After a while, your Gitlab instance will be accessible on http://localhost:3000.
190
191 Once you have set your new root password, you can login with the root user.
192
193 You can now setup a personal access token here: http://localhost:3000/profile/personal_access_tokens
194
195 Once you have your token, set the variables to the correct values in the `docker.env` file.
196
197 Then, launch the tool:
198
199 ```shell
200 docker-compose run app
201 ```
202
203 ```ruby
204 Gitlab.users
205 => [#<Gitlab::ObjectifiedHash:47231290771040 {hash: {"id"=>1, "name"=>"Administrator", "username"=>"root", ...]
206 ```
207
208 To launch the specs,
209
210 ```shell
211 docker-compose run app rake spec
212 ```
213
214 #### Want to use Gitlab Enterprise?
215
216 Just change the image from `gitlab/gitlab-ce:latest` to `gitlab/gitlab-ee:latest` in the `docker-compose.yml` file.
217
218 ### With an external Gitlab instance
219
220 First, set the variables to the correct values in the `docker.env` file.
221
222 Then, launch the tool:
223
224 ```shell
225 docker-compose run app
226 ```
227
228 ```ruby
229 Gitlab.users
230 => [#<Gitlab::ObjectifiedHash:47231290771040 {hash: {"id"=>1, "name"=>"Administrator", "username"=>"root", ...]
231 ```
232
233 To launch the specs,
234
235 ```shell
236 docker-compose run app rake spec
237 ```
238
239 ### Without Docker
240
177241 After checking out the repo, run `bin/setup` to install dependencies. Then, run
178242 `rake spec` to run the tests. You can also run `bin/console` for an interactive
179243 prompt that will allow you to experiment.
0 require "bundler/gem_tasks"
0 require 'bundler/gem_tasks'
11
22 require 'rspec/core/rake_task'
33 RSpec::Core::RakeTask.new(:spec) do |spec|
4 spec.pattern = FileList['spec/**/*_spec.rb']
54 spec.rspec_opts = ['--color', '--format d']
65 end
76
8 task default: :spec
7 require 'rubocop/rake_task'
8 RuboCop::RakeTask.new(:rubocop) do |task|
9 task.options = ['-D', '--parallel']
10 end
11
12 if ENV['TRAVIS_CI_RUBOCOP']
13 task default: :rubocop
14 else
15 task default: :spec
16 end
0 # -*- encoding: utf-8 -*-
10 lib = File.expand_path('../lib', __FILE__)
21 $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
32 require 'gitlab/version'
43
54 Gem::Specification.new do |gem|
6 gem.name = "gitlab"
5 gem.name = 'gitlab'
76 gem.version = Gitlab::VERSION
8 gem.authors = ["Nihad Abbasov"]
9 gem.email = ["mail@narkoz.me"]
10 gem.description = %q{Ruby client and CLI for GitLab API}
11 gem.summary = %q{A Ruby wrapper and CLI for the GitLab API}
12 gem.homepage = "https://github.com/narkoz/gitlab"
7 gem.authors = ['Nihad Abbasov', 'Sean Edge']
8 gem.email = ['mail@narkoz.me', 'asedge@gmail.com']
9 gem.description = 'Ruby client and CLI for GitLab API'
10 gem.summary = 'A Ruby wrapper and CLI for the GitLab API'
11 gem.homepage = 'https://github.com/narkoz/gitlab'
1312
14 gem.files = `git ls-files`.split($/)
15 gem.bindir = "exe"
13 gem.files = `git ls-files`.split($/).
14 reject { |f| f[/^spec/] } -
15 %w[Dockerfile docker-compose.yml docker.env .travis.yml .rubocop.yml .dockerignore]
16 gem.bindir = 'exe'
1617 gem.executables = gem.files.grep(%r{^exe/}) { |f| File.basename(f) }
1718 gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18 gem.require_paths = ["lib"]
19 gem.license = "BSD"
19 gem.require_paths = ['lib']
20 gem.license = 'BSD'
2021
21 gem.required_ruby_version = ">= 2.0.0"
22 gem.required_ruby_version = '>= 2.0.0'
2223
23 gem.add_runtime_dependency 'httparty'
24 gem.add_runtime_dependency 'terminal-table'
24 gem.add_runtime_dependency 'httparty', '>= 0.14.0'
25 gem.add_runtime_dependency 'terminal-table', '>= 1.5.1'
2526
2627 gem.add_development_dependency 'pry'
2728 gem.add_development_dependency 'rake'
2829 gem.add_development_dependency 'rspec'
2930 gem.add_development_dependency 'webmock'
31 gem.add_development_dependency 'rubocop'
3032 end
1212 (Configuration::VALID_OPTIONS_KEYS + [:auth_token]).each do |key|
1313 send("#{key}=", options[key]) if options[key]
1414 end
15 set_request_defaults(@sudo)
15 request_defaults(@sudo)
16 self.class.headers 'User-Agent' => user_agent
1617 end
1718 end
1819 end
5151 end
5252
5353 unless valid_command?(cmd)
54 puts "Unknown command. Run `gitlab help` for a list of available commands."
54 puts 'Unknown command. Run `gitlab help` for a list of available commands.'
5555 exit(1)
5656 end
5757
58 if args.any? && (args.last.start_with?('--only=') || args.last.start_with?('--except='))
59 command_args = args[0..-2]
60 else
61 command_args = args
62 end
58 command_args = args.any? && args.last.start_with?('--only=', '--except=') ? args[0..-2] : args
6359
6460 begin
6561 command_args.map! { |arg| symbolize_keys(yaml_load(arg)) }
6666 #
6767 # @return [String]
6868 def confirm_command(cmd)
69 if cmd.start_with?('remove_') || cmd.start_with?('delete_')
70 puts "Are you sure? (y/n)"
71 if %w(y yes).include?($stdin.gets.to_s.strip.downcase)
72 puts 'Proceeding..'
73 else
74 puts 'Command aborted.'
75 exit(1)
76 end
69 return unless cmd.start_with?('remove_', 'delete_')
70
71 puts 'Are you sure? (y/n)'
72
73 if %w(y yes).include?($stdin.gets.to_s.strip.downcase)
74 puts 'Proceeding..'
75 else
76 puts 'Command aborted.'
77 exit(1)
7778 end
7879 end
7980
101102 end
102103
103104 def output_json(cmd, args, data)
104 if data.empty?
105 if data.respond_to?(:empty?) && data.empty?
105106 puts '{}'
106107 else
107108 hash_result = case data
108 when Gitlab::ObjectifiedHash,Gitlab::FileResponse
109 when Gitlab::ObjectifiedHash, Gitlab::FileResponse
109110 record_hash([data], cmd, args, true)
110111 when Gitlab::PaginatedResponse
111112 record_hash(data, cmd, args)
112113 else
113114 { cmd: cmd, data: data, args: args }
114 end
115 end
115116 puts JSON.pretty_generate(hash_result)
116117 end
117118 end
134135 keys.each do |key|
135136 case value = hash[key]
136137 when Hash
137 value = value.has_key?('id') ? value['id'] : 'Hash'
138 value = value.key?('id') ? value['id'] : 'Hash'
138139 when StringIO
139140 value = 'File'
140141 when nil
193194 # Helper function to get rows and keys from data returned from API call
194195 def get_keys(args, data)
195196 arr = data.map(&:to_h)
196 keys = arr.first.keys.sort { |x, y| x.to_s <=> y.to_s }
197 keys = arr.first.keys.sort_by(&:to_s)
197198 keys &= required_fields(args) if required_fields(args).any?
198199 keys -= excluded_fields(args)
199200 [arr, keys]
219220 begin
220221 newhash[key.to_sym] = symbolize_keys(value)
221222 rescue NoMethodError
222 raise "error: cannot convert hash key to symbol: #{key}"
223 raise "Error: cannot convert hash key to symbol: #{key}"
223224 end
224225 end
225226 end
229230
230231 # YAML::load on a single argument
231232 def yaml_load(arg)
232 begin
233 yaml = YAML.load(arg)
234 rescue Psych::SyntaxError
235 raise "error: Argument is not valid YAML syntax: #{arg}"
236 end
237 yaml
233 YAML.safe_load(arg)
234 rescue Psych::SyntaxError
235 raise "Error: Argument is not valid YAML syntax: #{arg}"
238236 end
239237 end
240238 end
0 class Gitlab::Client
1 # Defines methods related to Award Emojis.
2 # @see https://docs.gitlab.com/ce/api/access_requests.html
3 module AccessRequests
4 # Gets a list of access requests for a project viewable by the authenticated user.
5 #
6 # @example
7 # Gitlab.project_access_requests(1)
8 #
9 # @param [Integer, String] :project(required) The ID or name of a project.
10 # @return [Array<Gitlab::ObjectifiedHash>] List of project access requests
11 def project_access_requests(project)
12 get("/projects/#{url_encode project}/access_requests")
13 end
14 # Gets a list of access requests for a group viewable by the authenticated user.
15 #
16 # @example
17 # Gitlab.group_access_requests(1)
18 #
19 # @param [Integer, String] :group(required) The ID or name of a group.
20 # @return [Array<Gitlab::ObjectifiedHash>] List of group access requests
21 def group_access_requests(group)
22 get("/groups/#{url_encode group}/access_requests")
23 end
24 # Requests access for the authenticated user to a project.
25 #
26 # @example
27 # Gitlab.request_project_access(1)
28 #
29 # @param [Integer, String] :project(required) The ID or name of a project.
30 # @return <Gitlab::ObjectifiedHash] Information about the requested project access
31 def request_project_access(project)
32 post("/projects/#{url_encode project}/access_requests")
33 end
34 # Requests access for the authenticated user to a group.
35 #
36 # @example
37 # Gitlab.request_group_access(1)
38 #
39 # @param [Integer, String] :group(required) The ID or name of a group.
40 # @return <Gitlab::ObjectifiedHash] Information about the requested group access
41 def request_group_access(group)
42 post("/groups/#{url_encode group}/access_requests")
43 end
44 # Approves a project access request for the given user.
45 #
46 # @example
47 # Gitlab.approve_project_access_request(1, 1)
48 # Gitlab.approve_project_access_request(1, 1, {access_level: '30'})
49 #
50 # @param [Integer, String] :project(required) The ID or name of a project.
51 # @param [Integer] :user_id(required) The user ID of the access requester
52 # @option options [Integer] :access_level(optional) A valid access level (defaults: 30, developer access level)
53 # @return <Gitlab::ObjectifiedHash] Information about the approved project access request
54 def approve_project_access_request(project, user_id, options = {})
55 put("/projects/#{url_encode project}/access_requests/#{user_id}/approve", body: options)
56 end
57 # Approves a group access request for the given user.
58 #
59 # @example
60 # Gitlab.approve_group_access_request(1, 1)
61 # Gitlab.approve_group_access_request(1, 1, {access_level: '30'})
62 #
63 # @param [Integer, String] :group(required) The ID or name of a group.
64 # @param [Integer] :user_id(required) The user ID of the access requester
65 # @option options [Integer] :access_level(optional) A valid access level (defaults: 30, developer access level)
66 # @return <Gitlab::ObjectifiedHash] Information about the approved group access request
67 def approve_group_access_request(group, user_id, options = {})
68 put("/groups/#{url_encode group}/access_requests/#{user_id}/approve", body: options)
69 end
70 # Denies a project access request for the given user.
71 #
72 # @example
73 # Gitlab.deny_project_access_request(1, 1)
74 #
75 # @param [Integer, String] :project(required) The ID or name of a project.
76 # @param [Integer] :user_id(required) The user ID of the access requester
77 # @return [void] This API call returns an empty response body.
78 def deny_project_access_request(project, user_id)
79 delete("/projects/#{url_encode project}/access_requests/#{user_id}")
80 end
81 # Denies a group access request for the given user.
82 #
83 # @example
84 # Gitlab.deny_group_access_request(1, 1)
85 #
86 # @param [Integer, String] :group(required) The ID or name of a group.
87 # @param [Integer] :user_id(required) The user ID of the access requester
88 # @return [void] This API call returns an empty response body.
89 def deny_group_access_request(group, user_id)
90 delete("/groups/#{url_encode group}/access_requests/#{user_id}")
91 end
92 end
93 end
2626 # @param [String] branch The name of the branch.
2727 # @return [Gitlab::ObjectifiedHash]
2828 def branch(project, branch)
29 get("/projects/#{url_encode project}/repository/branches/#{branch}")
29 get("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
3030 end
3131 alias_method :repo_branch, :branch
3232
4646 # @option options [Boolean] :developers_can_merge True to allow developers to merge into the branch (default = false)
4747 # @return [Gitlab::ObjectifiedHash] Details about the branch
4848 def protect_branch(project, branch, options = {})
49 put("/projects/#{url_encode project}/repository/branches/#{branch}/protect", body: options)
49 post("/projects/#{url_encode project}/protected_branches", body: {name: branch}.merge(options))
5050 end
5151 alias_method :repo_protect_branch, :protect_branch
5252
6060 # @param [String] branch The name of the branch.
6161 # @return [Gitlab::ObjectifiedHash] Details about the branch
6262 def unprotect_branch(project, branch)
63 put("/projects/#{url_encode project}/repository/branches/#{branch}/unprotect")
63 delete("/projects/#{url_encode project}/protected_branches/#{url_encode branch}")
6464 end
6565 alias_method :repo_unprotect_branch, :unprotect_branch
6666
6767 # Creates a repository branch. Requires Gitlab >= 6.8.x
6868 #
6969 # @example
70 # Gitlab.create_branch(3, 'api')
71 # Gitlab.repo_create_branch(5, 'master')
70 # Gitlab.create_branch(3, 'api', 'feat/new-api')
71 # Gitlab.repo_create_branch(5, 'master', 'develop')
7272 #
7373 # @param [Integer, String] project The ID or name of a project.
7474 # @param [String] branch The name of the new branch.
7575 # @param [String] ref Create branch from commit sha or existing branch
7676 # @return [Gitlab::ObjectifiedHash] Details about the branch
7777 def create_branch(project, branch, ref)
78 post("/projects/#{url_encode project}/repository/branches", body: { branch: branch, ref: ref })
78 post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref })
7979 end
8080 alias_method :repo_create_branch, :create_branch
8181
8888 # @param [Integer, String] project The ID or name of a project.
8989 # @param [String] branch The name of the branch to delete
9090 def delete_branch(project, branch)
91 delete("/projects/#{url_encode project}/repository/branches/#{branch}")
91 delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
9292 end
9393 alias_method :repo_delete_branch, :delete_branch
9494 end
00 class Gitlab::Client
11 # Defines methods related to builds.
22 # @see https://docs.gitlab.com/ce/api/build_variables.html
3 # @see https://docs.gitlab.com/ee/api/group_level_variables.html
34 module BuildVariables
45 # Gets a list of the project's build variables
56 #
1516 # Gets details of a project's specific build variable.
1617 #
1718 # @example
18 # Gitlab.build(5, "TEST_VARIABLE_1")
19 # Gitlab.variable(5, "TEST_VARIABLE_1")
1920 #
2021 # @param [Integer, String] project The ID or name of a project.
2122 # @param [String] key The key of a variable.
4041 # Update a project's build variable.
4142 #
4243 # @example
43 # Gitlab.create_variable(5, "NEW_VARIABLE", "updated value")
44 # Gitlab.update_variable(5, "NEW_VARIABLE", "updated value")
4445 #
4546 # @param [Integer, String] project The ID or name of a project.
4647 # @param [String] key The key of a variable
6162 def remove_variable(project, key)
6263 delete("/projects/#{url_encode project}/variables/#{key}")
6364 end
65
66 # Gets a list of the group's build variables
67 #
68 # @example
69 # Gitlab.group_variables(5)
70 #
71 # @param [Integer, String] group The ID or name of a group.
72 # @return [Array<Gitlab::ObjectifiedHash>] The list of variables.
73 def group_variables(group)
74 get("/groups/#{url_encode group}/variables")
75 end
76
77 # Gets details of a group's specific build variable.
78 #
79 # @example
80 # Gitlab.group_variable(5, "TEST_VARIABLE_1")
81 #
82 # @param [Integer, String] group The ID or name of a group.
83 # @param [String] key The key of a variable.
84 # @return [Gitlab::ObjectifiedHash] The variable.
85 def group_variable(group, key)
86 get("/groups/#{url_encode group}/variables/#{key}")
87 end
88
89 # Create a build variable for a group.
90 #
91 # @example
92 # Gitlab.create_group_variable(5, "NEW_VARIABLE", "new value")
93 #
94 # @param [Integer, String] group The ID or name of a group.
95 # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed
96 # @param [String] value The value of a variable
97 # @return [Gitlab::ObjectifiedHash] The variable.
98 def create_group_variable(group, key, value)
99 post("/groups/#{url_encode group}/variables", body: { key: key, value: value })
100 end
101
102 # Update a group's build variable.
103 #
104 # @example
105 # Gitlab.update_group_variable(5, "NEW_VARIABLE", "updated value")
106 #
107 # @param [Integer, String] group The ID or name of a group.
108 # @param [String] key The key of a variable
109 # @param [String] value The value of a variable
110 # @return [Gitlab::ObjectifiedHash] The variable.
111 def update_group_variable(group, key, value)
112 put("/groups/#{url_encode group}/variables/#{key}", body: { value: value })
113 end
114
115 # Remove a group's build variable.
116 #
117 # @example
118 # Gitlab.remove_group_variable(5, "VARIABLE_1")
119 #
120 # @param [Integer, String] group The ID or name of a group.
121 # @param [String] key The key of a variable.
122 # @return [Gitlab::ObjectifiedHash] The variable.
123 def remove_group_variable(group, key)
124 delete("/groups/#{url_encode group}/variables/#{key}")
125 end
64126 end
65127 end
141141 }.merge(options)
142142 post("/projects/#{url_encode project}/repository/commits", body: payload)
143143 end
144
145 # Gets a list of merge requests for a commit.
146 #
147 # @see https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit
148 # Introduced in Gitlab 10.7
149 #
150 # @example
151 # Gitlab.commit_merge_requests(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b')
152 #
153 # @param [Integer] project The ID of a project.
154 # @param [String] sha The commit hash.
155 # @option options [Integer] :page The page number.
156 # @option options [Integer] :per_page The number of results per page.
157 # @return [Array<Gitlab::ObjectifiedHash>]
158 def commit_merge_requests(project, commit, options={})
159 get("/projects/#{url_encode project}/repository/commits/#{commit}/merge_requests", query: options)
160 end
161 alias_method :repo_commit_merge_requests, :commit_merge_requests
144162 end
145163 end
0 class Gitlab::Client
1 # Defines methods related to deployments.
2 # @see https://docs.gitlab.com/ce/api/deployments.html
3 module Deployments
4 # Gets a list of project deployments.
5 #
6 # @example
7 # Gitlab.deployments(5)
8 # Gitlab.deployments(5, { per_page: 10, page: 2 })
9 #
10 # @param [Integer, String] project The ID or name of a project.
11 # @param [Hash] options A customizable set of options.
12 # @option options [Integer] :page The page number.
13 # @option options [Integer] :per_page The number of results per page.
14 # @return [Array<Gitlab::ObjectifiedHash>]
15 def deployments(project, options={})
16 get("/projects/#{url_encode project}/deployments", query: options)
17 end
18
19 # Gets a single deployment.
20 #
21 # @example
22 # Gitlab.deployment(5, 36)
23 #
24 # @param [Integer, String] project The ID or name of a project.
25 # @param [Integer] id The ID of an deployment.
26 # @return [Gitlab::ObjectifiedHash]
27 def deployment(project, id)
28 get("/projects/#{url_encode project}/deployments/#{id}")
29 end
30 end
31 end
0 class Gitlab::Client
1 # Defines methods related to events.
2 # @see https://docs.gitlab.com/ce/api/events.html
3 module Events
4 # Gets a list of authenticated user's events
5 #
6 # @example
7 # Gitlab.events()
8 # Gitlab.events({ action: 'created', target_type: 'issue' })
9 #
10 # @param [Hash] options A customizable set of options.
11 # @option options [String] :action Only events of specific action type
12 # @option options [String] :target_type Only events of specific target type
13 # @option options [String] :before Only events created before YYYY-MM-DD
14 # @option options [String] :after Only events created after YYYY-MM-DD
15 # @option options [String] :sort Sort by created_at either 'asc' or 'desc'
16 # @return [Array<Gitlab::ObjectifiedHash>]
17 def events(options={})
18 get('/events', query: options)
19 end
20
21 # Gets a list of user contribution events
22 #
23 # @example
24 # Gitlab.user_events(1)
25 # Gitlab.user_events(1, { action: created})
26 #
27 # @param [Integer, String] user The ID or username of user
28 # @param [Hash] options A customizable set of options.
29 # @option options [String] :action Only events of specific action type
30 # @option options [String] :target_type Only events of specific target type
31 # @option options [String] :before Only events created before YYYY-MM-DD
32 # @option options [String] :after Only events created after YYYY-MM-DD
33 # @option options [String] :sort Sort by created_at either 'asc' or 'desc'
34 # @return [Array<Gitlab::ObjectifiedHash>]
35 def user_events(user, options={})
36 get("/users/#{url_encode user}/events", query: options)
37 end
38
39 # Gets a list of visible project events
40 #
41 # @example
42 # Gitlab.project_events(1)
43 # Gitlab.project_events(1, { action: created })
44 #
45 # @param [Integer] project The ID of project
46 # @param [Hash] options A customizable set of options.
47 # @option options [String] :action Only events of specific action type
48 # @option options [String] :target_type Only events of specific target type
49 # @option options [String] :before Only events created before YYYY-MM-DD
50 # @option options [String] :after Only events created after YYYY-MM-DD
51 # @option options [String] :sort Sort by created_at either 'asc' or 'desc'
52 # @return [Array<Gitlab::ObjectifiedHash>]
53 def project_events(project, options={})
54 get("/#{url_encode project}/events", query: options)
55 end
56 end
57 end
0 class Gitlab::Client
1 # Defines methods related to group milestones.
2 # @see https://docs.gitlab.com/ee/api/group_milestones.html
3 module GroupMilestones
4 # Gets a list of a group's milestones.
5 #
6 # @example
7 # Gitlab.group_milestones(5)
8 #
9 # @param [Integer, String] id The ID or name of a group.
10 # @param [Hash] options A customizable set of options.
11 # @option options [Integer] :page The page number.
12 # @option options [Integer] :per_page The number of results per page.
13 # @return [Array<Gitlab::ObjectifiedHash>]
14 def group_milestones(id, options={})
15 get("/groups/#{url_encode id}/milestones", query: options)
16 end
17
18 # Gets a single group milestone.
19 #
20 # @example
21 # Gitlab.group_milestone(5, 36)
22 #
23 # @param [Integer, String] id The ID or name of a group.
24 # @param [Integer] milestone_id The ID of a milestone.
25 # @return [Gitlab::ObjectifiedHash]
26 def group_milestone(id, milestone_id)
27 get("/groups/#{url_encode id}/milestones/#{milestone_id}")
28 end
29
30 # Creates a new group milestone.
31 #
32 # @example
33 # Gitlab.create_group_milestone(5, 'v1.0')
34 #
35 # @param [Integer, String] id The ID or name of a group.
36 # @param [String] title The title of a milestone.
37 # @param [Hash] options A customizable set of options.
38 # @option options [String] :description The description of a milestone.
39 # @option options [String] :due_date The due date of a milestone.
40 # @return [Gitlab::ObjectifiedHash] Information about created milestone.
41 def create_group_milestone(id, title, options={})
42 body = { title: title }.merge(options)
43 post("/groups/#{url_encode id}/milestones", body: body)
44 end
45
46 # Updates a group milestone.
47 #
48 # @example
49 # Gitlab.edit_group_milestone(5, 2, { state_event: 'activate' })
50 #
51 # @param [Integer, String] id The ID or name of a group.
52 # @param [Integer] milestone_id The ID of a milestone.
53 # @param [Hash] options A customizable set of options.
54 # @option options [String] :title The title of a milestone.
55 # @option options [String] :description The description of a milestone.
56 # @option options [String] :due_date The due date of a milestone.
57 # @option options [String] :state_event The state of a milestone ('close' or 'activate').
58 # @return [Gitlab::ObjectifiedHash] Information about updated milestone.
59 def edit_group_milestone(id, milestone_id, options={})
60 put("/groups/#{url_encode id}/milestones/#{milestone_id}", body: options)
61 end
62
63 # Gets the issues of a given group milestone.
64 #
65 # @example
66 # Gitlab.group_milestone_issues(5, 2)
67 #
68 # @param [Integer, String] id The ID or name of a group.
69 # @param [Integer, String] milestone_id The ID of a milestone.
70 # @option options [Integer] :page The page number.
71 # @option options [Integer] :per_page The number of results per page.
72 # @return [Array<Gitlab::ObjectifiedHash>]
73 def group_milestone_issues(id, milestone_id, options={})
74 get("/groups/#{url_encode id}/milestones/#{milestone_id}/issues", query: options)
75 end
76
77 # Gets the merge_requests of a given group milestone.
78 #
79 # @example
80 # Gitlab.group_milestone_merge_requests(5, 2)
81 #
82 # @param [Integer, String] group The ID or name of a group.
83 # @param [Integer, String] milestone_id The ID of a milestone.
84 # @option options [Integer] :page The page number.
85 # @option options [Integer] :per_page The number of results per page.
86 # @return [Array<Gitlab::ObjectifiedHash>]
87 def group_milestone_merge_requests(id, milestone_id, options={})
88 get("/groups/#{url_encode id}/milestones/#{milestone_id}/merge_requests", query: options)
89 end
90 end
91 end
92
2323 # @param [Integer] id The ID of a group.
2424 # @return [Gitlab::ObjectifiedHash]
2525 def group(id)
26 get("/groups/#{id}")
26 get("/groups/#{url_encode id}")
2727 end
2828
2929 # Creates a new group.
4747 # @param [Integer] id The ID of a group
4848 # @return [Gitlab::ObjectifiedHash] Information about the deleted group.
4949 def delete_group(id)
50 delete("/groups/#{id}")
50 delete("/groups/#{url_encode id}")
5151 end
5252
5353 # Get a list of group members.
6262 # @option options [Integer] :per_page The number of results per page.
6363 # @return [Array<Gitlab::ObjectifiedHash>]
6464 def group_members(id, options={})
65 get("/groups/#{id}/members", query: options)
65 get("/groups/#{url_encode id}/members", query: options)
66 end
67
68 # Get details of a single group member.
69 #
70 # @example
71 # Gitlab.group_member(1, 10)
72 #
73 # @param [Integer] team_id The ID of the group to find a member in.
74 # @param [Integer] user_id The user id of the member to find.
75 # @return [Gitlab::ObjectifiedHash] (id, username, name, email, state, access_level ...)
76 def group_member(team_id, user_id)
77 get("/groups/#{url_encode team_id}/members/#{user_id}")
6678 end
6779
6880 # Adds a user to group.
7587 # @param [Integer] access_level Project access level.
7688 # @return [Gitlab::ObjectifiedHash] Information about added team member.
7789 def add_group_member(team_id, user_id, access_level)
78 post("/groups/#{team_id}/members", body: { user_id: user_id, access_level: access_level })
90 post("/groups/#{url_encode team_id}/members", body: { user_id: user_id, access_level: access_level })
7991 end
8092
8193 # Edit a user of a group.
88100 # @param [Integer] access_level Project access level.
89101 # @return [Gitlab::ObjectifiedHash] Information about edited team member.
90102 def edit_group_member(team_id, user_id, access_level)
91 put("/groups/#{team_id}/members/#{user_id}", body: { access_level: access_level })
103 put("/groups/#{url_encode team_id}/members/#{user_id}", body: { access_level: access_level })
92104 end
93105
94106 # Removes user from user group.
100112 # @param [Integer] user_id The ID of a user.
101113 # @return [Gitlab::ObjectifiedHash] Information about removed team member.
102114 def remove_group_member(team_id, user_id)
103 delete("/groups/#{team_id}/members/#{user_id}")
115 delete("/groups/#{url_encode team_id}/members/#{user_id}")
104116 end
105117
106118 # Transfers a project to a group
112124 # @param [Integer] project_id The ID of a project.
113125 def transfer_project_to_group(id, project_id)
114126 body = { id: id, project_id: project_id }
115 post("/groups/#{id}/projects/#{project_id}", body: body)
127 post("/groups/#{url_encode id}/projects/#{project_id}", body: body)
116128 end
117129
118130 # Search for groups by name
137149 # @param [Integer] id The ID of a group
138150 # @return [Array<Gitlab::ObjectifiedHash>] List of projects under a group
139151 def group_projects(id, options={})
140 get("/groups/#{id}/projects", query: options)
152 get("/groups/#{url_encode id}/projects", query: options)
153 end
154
155 # Get a list of subgroups under a group
156 # @example
157 # Gitlab.group_subgroups(1)
158 #
159 # @param [Integer] id the ID of a group
160 # @param [Hash] options A customizable set of options.
161 # @option options [String] :skip_groups Skip the group IDs passed.
162 # @option options [String] :all_available Show all the groups you have access to (defaults to false for authenticated users).
163 # @option options [String] :search Return the list of authorized groups matching the search criteria.
164 # @option options [String] :order_by Order groups by name or path. Default is name.
165 # @option options [String] :sort Order groups in asc or desc order. Default is asc.
166 # @option options [String] :statistics Include group statistics (admins only).
167 # @option options [String] :owned Limit to groups owned by the current user.
168 # @return [Array<Gitlab::ObjectifiedHash>] List of subgroups under a group
169 def group_subgroups(id, options={})
170 get("/groups/#{url_encode id}/subgroups", query: options)
171 end
172
173 # Updates an existing group.
174 #
175 # @example
176 # Gitlab.edit_group(42)
177 # Gitlab.edit_group(42, { name: 'Group Name' })
178 #
179 # @param [Integer] group The ID.
180 # @param [Hash] options A customizable set of options
181 # @option options [String] :name The name of the group.
182 # @option options [String] :path The path of the group.
183 # @option options [String] :description The description of the group.
184 # @option options [String] :visibility The visibility level of the group. Can be private, internal, or public
185 # @option options [String] :lfs_enabled Enable/disable Large File Storage (LFS) for the projects in this groupr.
186 # @option options [String] :request_access_enabled Allow users to request member access.
187 # @return [Gitlab::ObjectifiedHash] Information about the edited group.
188 def edit_group(id, options={})
189 put("/groups/#{url_encode id}", body: options)
141190 end
142191 end
143192 end
132132 def delete_issue(project, id)
133133 delete("/projects/#{url_encode project}/issues/#{id}")
134134 end
135
136 # Move an issue.
137 #
138 # @example
139 # Gitlab.move_issue(3, 42, { to_project_id: '4' })
140 #
141 # @param [Integer, String] project The ID or name of a project.
142 # @param [Integer] id The ID of an issue.
143 # @option options [String] :to_project_id The ID of the new project.
144 # @return [Gitlab::ObjectifiedHash] Information about moved issue.
145 def move_issue(project, id, options={})
146 post("/projects/#{url_encode project}/issues/#{id}/move", body: options)
147 end
148
149 # Sets an estimated time of work for an issue.
150 #
151 # @example
152 # Gitlab.estimate_time_of_issue(3, 42, '3h30m')
153 #
154 # @param [Integer, String] project The ID or name of a project.
155 # @param [Integer] id The ID of an issue.
156 # @param [String] duration The duration in human format. e.g: 3h30m
157 def estimate_time_of_issue(project, id, duration)
158 post("/projects/#{url_encode project}/issues/#{id}/time_estimate", body: { duration: url_encode(duration) })
159 end
160
161 # Resets the estimated time for an issue to 0 seconds.
162 #
163 # @example
164 # Gitlab.reset_time_estimate_of_issue(3, 42)
165 #
166 # @param [Integer, String] project The ID or name of a project.
167 # @param [Integer] id The ID of an issue.
168 def reset_time_estimate_of_issue(project, id)
169 post("/projects/#{url_encode project}/issues/#{id}/reset_time_estimate")
170 end
171
172 # Adds spent time for an issue
173 #
174 # @example
175 # Gitlab.estimate_time_of_issue(3, 42, '3h30m')
176 #
177 # @param [Integer, String] project The ID or name of a project.
178 # @param [Integer] id The ID of an issue.
179 # @param [String] duration The time spent in human format. e.g: 3h30m
180 def add_time_spent_on_issue(project, id, duration)
181 post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: url_encode(duration) })
182 end
183
184 # Resets the total spent time for this issue to 0 seconds.
185 #
186 # @example
187 # Gitlab.reset_time_spent_on_issue(3, 42)
188 #
189 # @param [Integer, String] project The ID or name of a project.
190 # @param [Integer] id The ID of an issue.
191 def reset_time_spent_on_issue(project, id)
192 post("/projects/#{url_encode project}/issues/#{id}/reset_spent_time")
193 end
194
195 # Get time tracking stats for an issue
196 #
197 # @example
198 # @gitlab.time_stats_for_issue(3, 42)
199 #
200 # @param [Integer, String] project The ID or name of a project.
201 # @param [Integer] id The ID of an issue.
202 def time_stats_for_issue(project, id)
203 get("/projects/#{url_encode project}/issues/#{id}/time_stats")
204 end
205
135206 end
136207 end
88 #
99 # @param [Integer, String] project The ID or name of a project.
1010 # @return [Array<Gitlab::ObjectifiedHash>]
11 def labels(project)
12 get("/projects/#{url_encode project}/labels")
11 def labels(project, options={})
12 get("/projects/#{url_encode project}/labels", query: options)
1313 end
1414
1515 # Creates a new label.
0 class Gitlab::Client
1 # Defines methods related to MR Approvals.
2 # @see https://docs.gitlab.com/ee/api/merge_request_approvals.html
3 module MergeRequestApprovals
4 # Gets MR Approval Configuration for a project
5 #
6 # @example
7 # Gitlab.project_merge_request_approvals(1)
8 #
9 # @param [Integer] project The ID of a project.
10 # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
11 def project_merge_request_approvals(project)
12 get("/projects/#{url_encode project}/approvals")
13 end
14
15 # Change MR Approval Configuration for a project
16 #
17 # @example
18 # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3})
19 # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, reset_approvals_on_push: true})
20 # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, disable_overriding_approvers_per_merge_request: false})
21 #
22 # @param [Integer] project(required) The ID of a project.
23 # @option options [Integer] :approvals_before_merge(optional) How many approvals are required before an MR can be merged
24 # @option options [Boolean] :reset_approvals_on_push(optional) Reset approvals on a new push
25 # @option options [Boolean] :disable_overriding_approvers_per_merge_request(optional) Allow/Disallow overriding approvers per MR
26 # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
27 def edit_project_merge_request_approvals(project, options = {})
28 post("/projects/#{url_encode project}/approvals", body: options)
29 end
30
31 # Change allowed approvers and approver groups for a project
32 #
33 # @example
34 # Gitlab.edit_project_approvers(1, {approver_ids: [5], approver_groups: [1]})
35 #
36 # @param [Integer] project(required) The ID of a project.
37 # @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs
38 # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs
39 # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
40 def edit_project_approvers(project, options = {})
41 put("/projects/#{url_encode project}/approvals", body: options)
42 end
43
44 # Get Configuration for approvals on a specific Merge Request.
45 #
46 # @example
47 # Gitlab.merge_request_approvals(1, 5)
48 #
49 # @param [Integer] project(required) The ID of a project.
50 # @param [Integer] merge_request(required) The IID of a merge_request.
51 # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the merge request
52 def merge_request_approvals(project, merge_request)
53 get("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals")
54 end
55
56 # Change configuration for approvals on a specific merge request.
57 #
58 # @example
59 # Gitlab.edit_merge_request_approvals(1, 5, approvals_required: 2)
60 #
61 # @param [Integer] project(required) The ID of a project.
62 # @param [Integer] merge_request(required) The IID of a merge_request.
63 # @option options [Integer] :approvals_required(required) Approvals required before MR can be merged
64 # @return [Gitlab::ObjectifiedHash] Updated MR approval configuration information about the merge request
65 def edit_merge_request_approvals(project, merge_request, options = {})
66 post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options)
67 end
68
69 # Change allowed approvers and approver groups for a merge request
70 #
71 # @example
72 # Gitlab.edit_merge_request_approvers(1, 5, {approver_ids: [5], approver_groups: [1]})
73 #
74 # @param [Integer] project(required) The ID of a project.
75 # @param [Integer] merge_request(required) The IID of a merge_request.
76 # @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs
77 # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs
78 # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
79 def edit_merge_request_approvers(project, merge_request, options = {})
80 put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options)
81 end
82
83 # Approve a merge request
84 #
85 # @example
86 # Gitlab.approve_merge_request(1, 5)
87 # Gitlab.approve_merge_request(1, 5, sha: 'fe678da')
88 #
89 # @param [Integer] project(required) The ID of a project.
90 # @param [Integer] merge_request(required) The IID of a merge request.
91 # @option options [String] :sha(optional) The HEAD of the MR
92 # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
93 def approve_merge_request(project, merge_request, options = {})
94 post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approve", body: options)
95 end
96
97 # Unapprove a merge request
98 #
99 # @example
100 # Gitlab.unapprove_merge_request(1, 5)
101 #
102 # @param [Integer] project(required) The ID of a project.
103 # @param [Integer] merge_request(required) The IID of a merge request.
104 # @return [void] This API call returns an empty response body.
105 def unapprove_merge_request(project, merge_request)
106 post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove")
107 end
108 end
109 end
11 # Defines methods related to merge requests.
22 # @see https://docs.gitlab.com/ce/api/merge_requests.html
33 module MergeRequests
4 # Gets a list of all of the merge requests the authenticated user has access to.
5 #
6 # @example
7 # Gitlab.user_merge_requests
8 # Gitlab.user_merge_requests(state: :opened, scope: :all)
9 #
10 # @param [Hash] options A customizable set of options.
11 # @return [Array<Gitlab::ObjectifiedHash>]
12 def user_merge_requests(options = {})
13 get('/merge_requests', query: options)
14 end
15
416 # Gets a list of project merge requests.
517 #
618 # @example
719 # Gitlab.merge_requests(5)
8 # Gitlab.merge_requests({ per_page: 40 })
20 # Gitlab.merge_requests(5, { per_page: 40 })
921 #
1022 # @param [Integer, String] project The ID or name of a project.
1123 # @param [Hash] options A customizable set of options.
4355 # @option options [String] :target_branch (required) The target branch name.
4456 # @option options [Integer] :assignee_id (optional) The ID of a user to assign merge request.
4557 # @option options [Integer] :target_project_id (optional) The target project ID.
58 # @option options [String] :labels (optional) Labels as a comma-separated list.
4659 # @return [Gitlab::ObjectifiedHash] Information about created merge request.
4760 def create_merge_request(project, title, options={})
4861 body = { title: title }.merge(options)
141154 def unsubscribe_from_merge_request(project, id)
142155 post("/projects/#{url_encode project}/merge_requests/#{id}/unsubscribe")
143156 end
157
158 # List project merge request discussions
159 #
160 # @example
161 # Gitlab.merge_request_discussions(5, 1)
162 # Gitlab.merge_request_discussions('gitlab', 1)
163 # @param [Integer, String] project The ID or name of a project.
164 # @param [Integer] id The ID of a merge request.
165 # @return [Gitlab::ObjectifiedHash] List of the merge request discussions.
166 def merge_request_discussions(project, merge_request_id)
167 get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions")
168 end
169
170 # Get single merge request discussion
171 #
172 # @example
173 # Gitlab.merge_request_discussion(5, 1, 1)
174 # Gitlab.merge_request_discussion('gitlab', 1, 1)
175 # @param [Integer, String] project The ID or name of a project.
176 # @param [Integer] id The ID of a merge request.
177 # @param [Integer] discussion_id The ID of a discussion.
178 # @return [Gitlab::ObjectifiedHash] The merge request discussion.
179 def merge_request_discussion(project, merge_request_id, discussion_id)
180 get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}")
181 end
182
183 # Create new merge request discussion
184 #
185 # @example
186 # Gitlab.create_merge_request_discussion(5, 1, body: 'discuss')
187 # Gitlab.create_merge_request_discussion('gitlab', 1, body: 'discuss')
188 # @param [Integer, String] project The ID or name of a project.
189 # @param [Integer] id The ID of a merge request.
190 # @param [Hash] options A customizable set of options.
191 # * :body (String) The content of a discussion
192 # * :created_at (String) Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z
193 # * :position (Hash) Position when creating a diff note
194 # * :base_sha (String) Base commit SHA in the source branch
195 # * :start_sha (String) SHA referencing commit in target branch
196 # * :head_sha (String) SHA referencing HEAD of this merge request
197 # * :position_type (String) Type of the position reference', allowed values: 'text' or 'image'
198 # * :new_path (String) File path after change
199 # * :new_line (Integer) Line number after change (for 'text' diff notes)
200 # * :old_path (String) File path before change
201 # * :old_line (Integer) Line number before change (for 'text' diff notes)
202 # * :width (Integer) Width of the image (for 'image' diff notes)
203 # * :height (Integer) Height of the image (for 'image' diff notes)
204 # * :x (Integer) X coordinate (for 'image' diff notes)
205 # * :y (Integer) Y coordinate (for 'image' diff notes)
206 # @return [Gitlab::ObjectifiedHash] The created merge request discussion.
207 def create_merge_request_discussion(project, merge_request_id, options={})
208 post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions", body: options)
209 end
210
211 # Resolve a merge request discussion
212 #
213 # @example
214 # Gitlab.resolve_merge_request_discussion(5, 1, 1, true)
215 # Gitlab.resolve_merge_request_discussion('gitlab', 1, 1, false)
216 # @param [Integer, String] project The ID or name of a project.
217 # @param [Integer] id The ID of a merge request.
218 # @param [Integer] discussion_id The ID of a discussion.
219 # @param [Hash] options A customizable set of options.
220 # @option options [Boolean] :resolved Resolve/unresolve the discussion.
221 # @return [Gitlab::ObjectifiedHash] The merge request discussion.
222 def resolve_merge_request_discussion(project, merge_request_id, discussion_id, options)
223 put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}", body: options)
224 end
225
226 # Add note to existing merge request discussion
227 #
228 # @example
229 # Gitlab.create_merge_request_discussion_note(5, 1, 1, note_id: 1, body: 'note')
230 # Gitlab.create_merge_request_discussion_note('gitlab', 1, 1, note_id: 1, body: 'note')
231 # @param [Integer, String] project The ID or name of a project.
232 # @param [Integer] id The ID of a merge request.
233 # @param [Integer] discussion_id The ID of a discussion.
234 # @param [Hash] options A customizable set of options.
235 # @option options [Integer] :note_id The ID of a discussion note.
236 # @option options [String] :body The content of a discussion.
237 # @option options [String] :created_at Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z.
238 # @return [Gitlab::ObjectifiedHash] The merge request discussion note.
239 def create_merge_request_discussion_note(project, merge_request_id, discussion_id, options)
240 post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes", body: options)
241 end
242
243 # Modify an existing merge request discussion note
244 #
245 # @example
246 # Gitlab.update_merge_request_discussion_note(5, 1, 1, 1, body: 'note')
247 # Gitlab.update_merge_request_discussion_note('gitlab', 1, 1, 1, body: 'note')
248 # @param [Integer, String] project The ID or name of a project.
249 # @param [Integer] id The ID of a merge request.
250 # @param [Integer] discussion_id The ID of a discussion.
251 # @param [Integer] note_id The ID of a discussion note.
252 # @param [Hash] options A customizable set of options.
253 # @option options [String] :body The content of a discussion.
254 # @option options [Boolean] :resolved Resolve/unresolve the note.
255 # @return [Gitlab::ObjectifiedHash] The merge request discussion note.
256 def update_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id, options)
257 put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}", body: options)
258 end
259
260 # Delete a merge request discussion note
261 #
262 # @example
263 # Gitlab.delete_merge_request_discussion_note(5, 1, 1, 1)
264 # Gitlab.delete_merge_request_discussion_note('gitlab', 1, 1, 1)
265 # @param [Integer, String] project The ID or name of a project.
266 # @param [Integer] id The ID of a merge request.
267 # @param [Integer] discussion_id The ID of a discussion.
268 # @param [Integer] note_id The ID of a discussion note.
269 # @return [Gitlab::ObjectifiedHash] An empty response.
270 def delete_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id)
271 delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}")
272 end
144273 end
145274 end
218218 #
219219 # @param [Integer] project The ID of a project.
220220 # @param [Integer] id The ID of a note.
221 # @param [String] body The content of a note.
221222 # @return [Gitlab::ObjectifiedHash]
222223 def edit_note(project, id, body)
223 put("/projects/#{url_encode project}/notes/#{id}", body: body)
224 put("/projects/#{url_encode project}/notes/#{id}", body: note_content(body))
224225 end
225226
226227 # Modifies an issue note.
231232 # @param [Integer] project The ID of a project.
232233 # @param [Integer] issue The ID of an issue.
233234 # @param [Integer] id The ID of a note.
235 # @param [String] body The content of a note.
234236 # @return [Gitlab::ObjectifiedHash]
235237 def edit_issue_note(project, issue, id, body)
236 put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: body)
238 put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: note_content(body))
237239 end
238240
239241 # Modifies a snippet note.
244246 # @param [Integer] project The ID of a project.
245247 # @param [Integer] snippet The ID of a snippet.
246248 # @param [Integer] id The ID of a note.
249 # @param [String] body The content of a note.
247250 # @return [Gitlab::ObjectifiedHash]
248251 def edit_snippet_note(project, snippet, id, body)
249 put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: body)
252 put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: note_content(body))
250253 end
251254
252255 # Modifies a merge_request note.
257260 # @param [Integer] project The ID of a project.
258261 # @param [Integer] merge_request The ID of a merge_request.
259262 # @param [Integer] id The ID of a note.
263 # @param [String] body The content of a note.
260264 # @return [Gitlab::ObjectifiedHash]
261265 def edit_merge_request_note(project, merge_request, id, body)
262 put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: body)
266 put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: note_content(body))
263267 end
264268 alias_method :edit_merge_request_comment, :edit_merge_request_note
269
270 private
271
272 # TODO: Remove this method after a couple deprecation cycles. Replace calls with the code
273 # in the 'else'.
274 def note_content(body)
275 if body.is_a?(Hash)
276 STDERR.puts "Passing the note body as a Hash is deprecated. You should just pass the String."
277 body
278 else
279 { body: body }
280 end
281 end
265282 end
266283 end
0 class Gitlab::Client
1 # Defines methods related to pipeline schedules.
2 # @see https://docs.gitlab.com/ce/api/pipeline_schedules.html
3 module PipelineSchedules
4 # Gets a list of project pipeline schedules.
5 #
6 # @example
7 # Gitlab.pipeline_schedules(5)
8 # Gitlab.pipeline_schedules(5, { scope: 'active' })
9 #
10 # @param [Integer, String] project the ID or name of a project.
11 # @param [Hash] options A customizable set of options.
12 # @options options [String] :scope The scope of pipeline schedules, one of a 'active' or 'inactive'.
13 # @return [Array<Gitlab::ObjectifiedHash>]
14 def pipeline_schedules(project, options={})
15 get("/projects/#{url_encode project}/pipeline_schedules", query: options)
16 end
17
18 # Gets a single pipeline schedule.
19 #
20 # @example
21 # Gitlab.pipeline_schedule(5, 3)
22 #
23 # @param [Integer, String] project The ID or name of a project.
24 # @param [Integer] id The ID of the pipeline schedule.
25 # @return [Gitlab::ObjectifiedHash]
26 def pipeline_schedule(project, id)
27 get("/projects/#{url_encode project}/pipeline_schedules/#{id}")
28 end
29
30 # Create a pipeline schedule.
31 #
32 # @example
33 # Gitlab.create_pipeline_schedule(5, { description: 'example' })
34 #
35 # @param [Integer, String] project The ID or name of a project.
36 # @param [Hash] options A customizable set of options.
37 # @option options [String] :description The description of pipeline scehdule.
38 # @option options [String] :ref The branch/tag name will be triggered.
39 # @option options [String] :cron The cron (e.g. 0 1 * * *).
40 # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC').
41 # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).
42 # @return [Array<Gitlab::ObjectifiedHash>]
43 def create_pipeline_schedule(project, options={})
44 post("/projects/#{url_encode project}/pipeline_schedules", query: options)
45 end
46
47 # Updates the pipeline schedule of a project.
48 #
49 # @example
50 # Gitlab.edit_pipeline_schedule(3, 2, { description: 'example2' })
51 #
52 # @param [Integer, String] project The ID or name of a project.
53 # @param [Integer] The pipeline schedule ID.
54 # @param [Hash] options A customizable set of options.
55 # @option options [String] :description The description of pipeline scehdule.
56 # @option options [String] :ref The branch/tag name will be triggered.
57 # @option options [String] :cron The cron (e.g. 0 1 * * *).
58 # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC').
59 # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).
60 # @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule.
61 def edit_pipeline_schedule(project, pipeline_schedule_id, options={})
62 put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}", query: options)
63 end
64
65 # Take ownership of a pipeline schedule.
66 #
67 # @example
68 # Gitlab.pipeline_schedule_take_ownership(5, 1)
69 #
70 # @param [Integer, String] project The ID or name of a project.
71 # @param [Integer] trigger_id The pipeline schedule ID.
72 # @return [Gitlab::ObjectifiedHash] The updated pipeline schedule.
73 def pipeline_schedule_take_ownership(project, pipeline_schedule_id)
74 post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/take_ownership")
75 end
76
77 # Delete a pipeline schedule.
78 #
79 # @example
80 # Gitlab.delete_pipeline_schedule(5, 1)
81 #
82 # @param [Integer, String] project The ID or name of a project.
83 # @param [Integer] trigger_id The pipeline schedule ID.
84 # @return [Gitlab::ObjectifiedHash] The deleted pipeline schedule.
85 def delete_pipeline_schedule(project, pipeline_schedule_id)
86 delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}")
87 end
88
89 # Create a pipeline schedule variable.
90 #
91 # @example
92 # Gitlab.create_pipeline_schedule_variable(5, 1, { key: 'foo', value: 'bar' })
93 #
94 # @param [Integer, String] project The ID or name of a project.
95 # @param [Integer] trigger_id The pipeline schedule ID.
96 # @param [Hash] options A customizable set of options.
97 # @option options [String] :key The key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed.
98 # @option options [String] :value The value of a variable
99 # @return [Array<Gitlab::ObjectifiedHash>] The created pipeline schedule variable.
100 def create_pipeline_schedule_variable(project, pipeline_schedule_id, options={})
101 post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables", query: options)
102 end
103
104 # Updates the variable of a pipeline schedule.
105 #
106 # @example
107 # Gitlab.edit_pipeline_schedule_variable(3, 2, "foo" { value: 'bar' })
108 #
109 # @param [Integer, String] project The ID or name of a project.
110 # @param [Integer] The pipeline schedule ID.
111 # @param [String] The key of a variable.
112 # @param [Hash] options A customizable set of options.
113 # @option options [String] :value The value of a variable.
114 # @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule variable.
115 def edit_pipeline_schedule_variable(project, pipeline_schedule_id, key, options={})
116 put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}", query: options)
117 end
118
119 # Delete the variable of a pipeline schedule
120 #
121 # @example
122 # Gitlab.delete_pipeline_schedule_variable(3, 2, "foo")
123 #
124 # @param [Integer, String] project The ID or name of a project.
125 # @param [Integer] The pipeline schedule ID.
126 # @param [String] The key of a variable.
127 # @return [Array<Gitlab::ObjectifiedHash>] The deleted pipeline schedule variable.
128 def delete_pipeline_schedule_variable(project, pipeline_schedule_id, key, options={})
129 delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}")
130 end
131 end
132 end
7979 # Run the given project pipeline trigger.
8080 #
8181 # @example
82 # Gitlab.trigger_build(5, '7b9148c158980bbd9bcea92c17522d', 'master')
83 # Gitlab.trigger_build(5, '7b9148c158980bbd9bcea92c17522d', 'master', { variable1: "value", variable2: "value2" })
82 # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master')
83 # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master', { variable1: "value", variable2: "value2" })
8484 #
8585 # @see https://docs.gitlab.com/ce/ci/triggers/README.html
8686 #
99 # @param [Hash] options A customizable set of options.
1010 # @option options [Integer] :page The page number.
1111 # @option options [Integer] :per_page The number of results per page.
12 # @option options [String] :scope Scope of projects. 'owned' for list of projects owned by the authenticated user, 'all' to get all projects (admin only)
12 # (Any provided options will be passed to Gitlab. See {https://docs.gitlab.com/ce/api/projects.html#list-all-projects Gitlab docs} for all valid options)
13 #
1314 # @return [Array<Gitlab::ObjectifiedHash>]
1415 def projects(options={})
15 if options[:scope]
16 get("/projects/#{options[:scope]}", query: options)
17 else
18 get("/projects", query: options)
19 end
16 get("/projects", query: options)
2017 end
2118
2219 # Search for projects by name.
4744 # @return [Gitlab::ObjectifiedHash]
4845 def project(id)
4946 get("/projects/#{url_encode id}")
50 end
51
52 # Gets a list of project events.
53 #
54 # @example
55 # Gitlab.project_events(42)
56 # Gitlab.project_events('gitlab')
57 #
58 # @param [Integer, String] project The ID or path of a project.
59 # @param [Hash] options A customizable set of options.
60 # @option options [Integer] :page The page number.
61 # @option options [Integer] :per_page The number of results per page.
62 # @return [Array<Gitlab::ObjectifiedHash>]
63 def project_events(project, options={})
64 get("/projects/#{url_encode project}/events", query: options)
6547 end
6648
6749 # Creates a new project.
297279 #
298280 # @param [Integer] id The ID of a project.
299281 # @return [Gitlab::ObjectifiedHash] Information about deleted push rule.
300 def delete_push_rule(id, options={})
282 def delete_push_rule(id)
301283 delete("/projects/#{url_encode id}/push_rule")
302284 end
303285
354336 # Creates a new deploy key.
355337 #
356338 # @example
357 # Gitlab.create_deploy_key(42, 'My Key', 'Key contents')
339 # Gitlab.create_deploy_key(42, 'My Key', 'Key contents', can_push: true)
358340 #
359341 # @param [Integer, String] project The ID or path of a project.
360342 # @param [String] title The title of a deploy key.
361343 # @param [String] key The content of a deploy key.
344 # @param [Hash] options A customizable set of options.
362345 # @return [Gitlab::ObjectifiedHash] Information about created deploy key.
363 def create_deploy_key(project, title, key)
364 post("/projects/#{url_encode project}/deploy_keys", body: { title: title, key: key })
346 def create_deploy_key(project, title, key, options = {})
347 post("/projects/#{url_encode project}/deploy_keys", body: { title: title, key: key }.merge(options))
365348 end
366349
367350 # Enables a deploy key at the project.
412395 # @return [Gitlab::ObjectifiedHash] Information about the forked project.
413396 def create_fork(id, options={})
414397 post("/projects/#{url_encode id}/fork", body: options)
398 end
399
400 # Get a list of all visible projects across GitLab for the authenticated user.
401 # When accessed without authentication, only public projects are returned.
402 #
403 # Note: This feature was introduced in GitLab 10.1
404 #
405 # @example
406 # Gitlab.project_forks(42)
407 #
408 # @param [Hash] options A customizable set of options.
409 # @option options [Integer] :page The page number.
410 # @option options [Integer] :per_page The number of results per page.
411 # @option options [String] :order_by Return requests ordered by id, name, created_at or last_activity_at fields
412 # @option options [String] :sort Return requests sorted in asc or desc order
413 # @return [Array<Gitlab::ObjectifiedHash>]
414 def project_forks(id, options={})
415 get("/projects/#{url_encode id}/forks", query: options)
415416 end
416417
417418 # Updates an existing project.
445446 post("/projects/#{url_encode project}/share", body: { group_id: id, group_access: group_access })
446447 end
447448
449 # Unshare project with group.
450 #
451 # @example
452 # Gitlab.unshare_project_with_group('gitlab', 2)
453 #
454 # @param [Integer, String] project The ID or path of a project.
455 # @param [Integer] id The ID of a group.
456 # @return [void] This API call returns an empty response body.
457 def unshare_project_with_group(project, id)
458 delete("/projects/#{url_encode project}/share/#{id}")
459 end
460
448461 # Stars a project.
449462 # @see https://docs.gitlab.com/ce/api/projects.html#star-a-project
450463 #
470483 def unstar_project(id)
471484 delete("/projects/#{url_encode id}/star")
472485 end
486
487 # Get a list of visible projects for the given user.
488 # @see https://docs.gitlab.com/ee/api/projects.html#list-user-projects
489 #
490 # @example
491 # Gitlab.user_projects(1)
492 # Gitlab.user_projects(1, { order_by: 'last_activity_at' })
493 # Gitlab.user_projects('username', { order_by: 'name', sort: 'asc' })
494 #
495 # @param [Integer, String] user_id The ID or username of the user.
496 # @param [Hash] options A customizable set of options.
497 # @option options [String] :per_page Number of projects to return per page
498 # @option options [String] :page The page to retrieve
499 # @option options [String] :order_by Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields.
500 # @option options [String] :sort Return projects sorted in asc or desc order.
501 # @return [Array<Gitlab::ObjectifiedHash>]
502 def user_projects(user_id, options={})
503 get("/users/#{url_encode user_id}/projects", query: options)
504 end
473505 end
474506 end
1414 # @param [String] ref The name of a repository branch or tag or if not given the default branch.
1515 # @return [String]
1616 def file_contents(project, filepath, ref='master')
17 ref = URI.encode(ref, /\W/)
1817 get "/projects/#{url_encode project}/repository/files/#{url_encode filepath}/raw",
1918 query: { ref: ref},
2019 format: nil,
9493 # @option options [String] :author_email Commit author's email address
9594 # @return [Gitlab::ObjectifiedHash]
9695 def remove_file(project, path, branch, commit_message, options = {})
97 delete("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: {
96 delete("/projects/#{url_encode project}/repository/files/#{url_encode path}",
97 body: {
9898 branch: branch,
9999 commit_message: commit_message
100100 }.merge(options))
7171 delete("/runners/#{id}")
7272 end
7373
74 # Gets a list of Jobs for a Runner
75 #
76 # @example
77 # Gitlab.runner_jobs(1)
78 #
79 # @param [Integer] id The ID of a runner.
80 # @return [Array<Gitlab::ObjectifiedHash>]
81 def runner_jobs(runner_id)
82 get("/runners/#{url_encode runner_id}/jobs")
83 end
84
7485 # List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings.
7586 # @see https://docs.gitlab.com/ce/api/runners.html#list-projects-runners
7687 #
0 class Gitlab::Client
1 # Defines methods related to sidekiq metrics.
2 # @see https://docs.gitlab.com/ce/api/sidekiq_metrics.html
3 module Sidekiq
4 # Get the current Queue Metrics
5 #
6 # @example
7 # Gitlab.sidekiq_queue_metrics
8 def sidekiq_queue_metrics
9 get('/sidekiq/queue_metrics')
10 end
11
12 # Get the current Process Metrics
13 #
14 # @example
15 # Gitlab.sidekiq_process_metrics
16 def sidekiq_process_metrics
17 get('/sidekiq/process_metrics')
18 end
19
20 # Get the current Job Statistics
21 #
22 # @example
23 # Gitlab.sidekiq_job_stats
24 def sidekiq_job_stats
25 get('/sidekiq/job_stats')
26 end
27
28 # Get a compound response of all the previously mentioned metrics
29 #
30 # @example
31 # Gitlab.sidekiq_compound_metrics
32 def sidekiq_compound_metrics
33 get('/sidekiq/compound_metrics')
34 end
35 end
36 end
3030 # Creates a new snippet.
3131 #
3232 # @example
33 # Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code' })
33 # Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code', visibility: 'public'})
3434 #
3535 # @param [Integer, String] project The ID or name of a project.
3636 # @param [Hash] options A customizable set of options.
3838 # @option options [String] :file_name (required) The name of a snippet file.
3939 # @option options [String] :code (required) The content of a snippet.
4040 # @option options [String] :lifetime (optional) The expiration date of a snippet.
41 # @option options [String] :visibility (required) The visibility of a snippet
4142 # @return [Gitlab::ObjectifiedHash] Information about created snippet.
4243 def create_snippet(project, options={})
4344 post("/projects/#{url_encode project}/snippets", body: options)
5556 # @option options [String] :file_name The name of a snippet file.
5657 # @option options [String] :code The content of a snippet.
5758 # @option options [String] :lifetime The expiration date of a snippet.
59 # @option options [String] :visibility (optional) The visibility of a snippet
5860 # @return [Gitlab::ObjectifiedHash] Information about updated snippet.
5961 def edit_snippet(project, id, options={})
6062 put("/projects/#{url_encode project}/snippets/#{id}", body: options)
2929 # @param [String] description Optional release notes for tag.
3030 # @return [Gitlab::ObjectifiedHash]
3131 def create_tag(project, tag_name, ref, message='', description=nil)
32 post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, description: description })
32 post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, release_description: description })
3333 end
3434 alias_method :repo_create_tag, :create_tag
3535
4343 # @param [String] tag The name of the tag.
4444 # @return [Gitlab::ObjectifiedHash]
4545 def tag(project, tag)
46 get("/projects/#{url_encode project}/repository/tags/#{tag}")
46 get("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
4747 end
4848 alias_method :repo_tag, :tag
4949
5757 # @param [String] tag The name of the tag to delete
5858 # @return [Gitlab::ObjectifiedHash]
5959 def delete_tag(project, tag)
60 delete("/projects/#{url_encode project}/repository/tags/#{tag}")
60 delete("/projects/#{url_encode project}/repository/tags/#{url_encode tag}")
6161 end
6262 alias_method :repo_delete_tag, :delete_tag
6363
7272 # @param [String] description Release notes with markdown support
7373 # @return [Gitlab::ObjectifiedHash]
7474 def create_release(project, tag, description)
75 post("/projects/#{url_encode project}/repository/tags/#{tag}/release", body: { description: description })
75 post("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
7676 end
7777 alias_method :repo_create_release, :create_release
7878
8787 # @param [String] description Release notes with markdown support
8888 # @return [Gitlab::ObjectifiedHash]
8989 def update_release(project, tag, description)
90 put("/projects/#{url_encode project}/repository/tags/#{tag}/release", body: { description: description })
90 put("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description })
9191 end
9292 alias_method :repo_update_release, :update_release
9393
4848 # @return [Gitlab::ObjectifiedHash] Information about created user.
4949 def create_user(*args)
5050 options = Hash === args.last ? args.pop : {}
51 if args[2]
52 body = { email: args[0], password: args[1], username: args[2] }
53 else
54 body = { email: args[0], password: args[1], name: args[0] }
55 end
51 body = if args[2]
52 { email: args[0], password: args[1], username: args[2] }
53 else
54 { email: args[0], password: args[1], name: args[0] }
55 end
5656 body.merge!(options)
5757 post('/users', body: body)
5858 end
22 class Client < API
33 Dir[File.expand_path('../client/*.rb', __FILE__)].each { |f| require f }
44
5 # Please keep in alphabetical order
6 include AccessRequests
57 include AwardEmojis
68 include Boards
79 include Branches
10 include BuildVariables
811 include Builds
9 include BuildVariables
1012 include Commits
13 include Deployments
1114 include Environments
15 include Events
16 include GroupMilestones
1217 include Groups
1318 include Issues
19 include Jobs
1420 include Keys
1521 include Labels
22 include MergeRequestApprovals
1623 include MergeRequests
1724 include Milestones
1825 include Namespaces
1926 include Notes
27 include PipelineSchedules
28 include PipelineTriggers
2029 include Pipelines
21 include PipelineTriggers
2230 include Projects
2331 include Repositories
2432 include RepositoryFiles
2533 include Runners
2634 include Services
35 include Sidekiq
2736 include Snippets
2837 include SystemHooks
2938 include Tags
3039 include Todos
3140 include Users
32 include Jobs
3341
3442 # Text representation of the client, masking private token.
3543 #
4553 end
4654
4755 def url_encode(s)
48 ERB::Util.url_encode(s)
56 URI.encode(s.to_s, /\W/)
4957 end
5058
5159 private
5260
5361 def only_show_last_four_chars(token)
54 "#{'*'*(token.size - 4)}#{token[-4..-1]}"
62 "#{'*' * (token.size - 4)}#{token[-4..-1]}"
5563 end
5664 end
5765 end
22 # Defines constants and methods related to configuration.
33 module Configuration
44 # An array of valid keys in the options hash when configuring a Gitlab::API.
5 VALID_OPTIONS_KEYS = [:endpoint, :private_token, :user_agent, :sudo, :httparty].freeze
5 VALID_OPTIONS_KEYS = %i(endpoint private_token user_agent sudo httparty).freeze
66
77 # The user agent that will be sent to the API endpoint if none is set.
88 DEFAULT_USER_AGENT = "Gitlab Ruby Gem #{Gitlab::VERSION}".freeze
4747
4848 httparty = Gitlab::CLI::Helpers.yaml_load(options)
4949
50 raise ArgumentError, "HTTParty config should be a Hash." unless httparty.is_a? Hash
50 raise ArgumentError, 'HTTParty config should be a Hash.' unless httparty.is_a? Hash
5151 Gitlab::CLI::Helpers.symbolize_keys httparty
5252 end
5353 end
1010
1111 # Custom error class for rescuing from HTTP response errors.
1212 class ResponseError < Error
13 POSSIBLE_MESSAGE_KEYS = %i(message error_description error)
14
1315 def initialize(response)
1416 @response = response
1517 super(build_error_message)
1618 end
1719
18 # Status code returned in the http response.
20 # Status code returned in the HTTP response.
1921 #
2022 # @return [Integer]
2123 def response_status
2224 @response.code
25 end
26
27 # Body content returned in the HTTP response
28 #
29 # @return [String]
30 def response_message
31 @response.parsed_response.message
2332 end
2433
2534 private
2938 # @return [String]
3039 def build_error_message
3140 parsed_response = @response.parsed_response
32 message = parsed_response.message || parsed_response.error
33
41 message = check_error_keys(parsed_response)
3442 "Server responded with code #{@response.code}, message: " \
3543 "#{handle_message(message)}. " \
3644 "Request URI: #{@response.request.base_uri}#{@response.request.path}"
45 end
46
47 # Error keys vary across the API, find the first key that the parsed_response
48 # object responds to and return that, otherwise return the original.
49 def check_error_keys(resp)
50 key = POSSIBLE_MESSAGE_KEYS.find { |k| resp.respond_to?(k) }
51 key ? resp.send(key) : resp
3752 end
3853
3954 # Handle error response message in case of nested hashes
3838
3939 # Parse filename from the 'Content Disposition' header.
4040 def parse_headers!(headers)
41 @filename = headers[HEADER_CONTENT_DISPOSITION].split("filename=")[1]
41 @filename = headers[HEADER_CONTENT_DISPOSITION].split('filename=')[1]
4242 @filename = @filename[1...-1] if @filename[0] == '"' # Unquote filenames
4343 end
4444 end
3232 def ri_cmd
3333 which_ri = `which ri`.chomp
3434 if which_ri.empty?
35 fail "'ri' tool not found in $PATH. Please install it to use the help."
35 raise "'ri' tool not found in $PATH. Please install it to use the help."
3636 end
3737
3838 which_ri
6060 def actions_table(topic=nil)
6161 rows = topic ? help_map[topic] : help_map.keys
6262 table do |t|
63 t.title = topic || "Help Topics"
63 t.title = topic || 'Help Topics'
6464
6565 # add_row expects an array and we have strings hence the map.
6666 rows.sort.map { |r| [r] }.each_with_index do |row, index|
7272
7373 # Returns full namespace of a command (e.g. Gitlab::Client::Branches.cmd)
7474 def namespace(cmd)
75 method_owners.select { |method| method[:name] === cmd }.
75 method_owners.select { |method| method[:name] == cmd }.
7676 map { |method| method[:owner] + '.' + method[:name] }.
7777 shift
7878 end
8181 def change_help_output!(cmd, output_str)
8282 output_str.gsub!(/#{cmd}\((.*?)\)/m, cmd + ' \1')
8383 output_str.gsub!(/\,[\s]*/, ' ')
84
84
8585 # Ensure @option descriptions are on a single line
8686 output_str.gsub!(/\n\[/, " \[")
8787 output_str.gsub!(/\s(@)/, "\n@")
8888 output_str.gsub!(/(\])\n(\:)/, '\1 \2')
8989 output_str.gsub!(/(\:.*)(\n)(.*\.)/, '\1 \3')
9090 output_str.gsub!(/\{(.+)\}/, '"{\1}"')
91
9291 end
93 end # class << self
92 end
9493 end
55 HEADER_LINK = 'Link'.freeze
66 DELIM_LINKS = ','.freeze
77 LINK_REGEX = /<([^>]+)>; rel=\"([^\"]+)\"/
8 METAS = %w(last next first prev)
8 METAS = %w(last next first prev).freeze
99
1010 attr_accessor(*METAS)
1111
2424 LINK_REGEX.match(link.strip) do |match|
2525 url, meta = match[1], match[2]
2626 next if !url || !meta || METAS.index(meta).nil?
27 self.send("#{meta}=", url)
27 send("#{meta}=", url)
2828 end
2929 end
3030 end
2525 elsif body.nil?
2626 false
2727 else
28 raise Error::Parsing.new "Couldn't parse a response body"
28 raise Error::Parsing, "Couldn't parse a response body"
2929 end
3030 end
3131
3232 # Decodes a JSON response into Ruby object.
3333 def self.decode(response)
34 JSON.load response
34 return response ? JSON.load(response) : {}
3535 rescue JSON::ParserError
36 raise Error::Parsing.new "The response is not a valid JSON"
36 raise Error::Parsing, 'The response is not a valid JSON'
3737 end
3838
39 def get(path, options={})
40 set_httparty_config(options)
41 set_authorization_header(options)
42 validate self.class.get(@endpoint + path, options)
43 end
44
45 def post(path, options={})
46 set_httparty_config(options)
47 set_authorization_header(options)
48 validate self.class.post(@endpoint + path, options)
49 end
50
51 def put(path, options={})
52 set_httparty_config(options)
53 set_authorization_header(options)
54 validate self.class.put(@endpoint + path, options)
55 end
56
57 def delete(path, options={})
58 set_httparty_config(options)
59 set_authorization_header(options)
60 validate self.class.delete(@endpoint + path, options)
39 %w(get post put delete).each do |method|
40 define_method method do |path, options={}|
41 httparty_config(options)
42 authorization_header(options)
43 validate self.class.send(method, @endpoint + path, options)
44 end
6145 end
6246
6347 # Checks the response code for common errors.
6448 # Returns parsed response for successful requests.
6549 def validate(response)
6650 error_klass = case response.code
67 when 400 then Error::BadRequest
68 when 401 then Error::Unauthorized
69 when 403 then Error::Forbidden
70 when 404 then Error::NotFound
71 when 405 then Error::MethodNotAllowed
72 when 409 then Error::Conflict
73 when 422 then Error::Unprocessable
74 when 500 then Error::InternalServerError
75 when 502 then Error::BadGateway
76 when 503 then Error::ServiceUnavailable
77 end
51 when 400 then Error::BadRequest
52 when 401 then Error::Unauthorized
53 when 403 then Error::Forbidden
54 when 404 then Error::NotFound
55 when 405 then Error::MethodNotAllowed
56 when 409 then Error::Conflict
57 when 422 then Error::Unprocessable
58 when 500 then Error::InternalServerError
59 when 502 then Error::BadGateway
60 when 503 then Error::ServiceUnavailable
61 end
7862
79 fail error_klass.new(response) if error_klass
63 raise error_klass, response if error_klass
8064
8165 parsed = response.parsed_response
8266 parsed.client = self if parsed.respond_to?(:client=)
8670
8771 # Sets a base_uri and default_params for requests.
8872 # @raise [Error::MissingCredentials] if endpoint not set.
89 def set_request_defaults(sudo=nil)
73 def request_defaults(sudo=nil)
9074 self.class.default_params sudo: sudo
91 raise Error::MissingCredentials.new("Please set an endpoint to API") unless @endpoint
75 raise Error::MissingCredentials, 'Please set an endpoint to API' unless @endpoint
9276 self.class.default_params.delete(:sudo) if sudo.nil?
9377 end
9478
9983 # @param [Hash] options A customizable set of options.
10084 # @option options [Boolean] :unauthenticated true if the API call does not require user authentication.
10185 # @raise [Error::MissingCredentials] if private_token and auth_token are not set.
102 def set_authorization_header(options)
103 unless options[:unauthenticated]
104 raise Error::MissingCredentials.new("Please provide a private_token or auth_token for user") unless @private_token
105 if @private_token.length <= 20
106 options[:headers] = { 'PRIVATE-TOKEN' => @private_token }
107 else
108 options[:headers] = { 'Authorization' => "Bearer #{@private_token}" }
109 end
110 end
86 def authorization_header(options)
87 return if options[:unauthenticated]
88 raise Error::MissingCredentials, 'Please provide a private_token or auth_token for user' unless @private_token
89
90 options[:headers] = if @private_token.size < 21
91 { 'PRIVATE-TOKEN' => @private_token }
92 else
93 { 'Authorization' => "Bearer #{@private_token}" }
94 end
11195 end
11296
11397 # Set HTTParty configuration
11498 # @see https://github.com/jnunemaker/httparty
115 def set_httparty_config(options)
99 def httparty_config(options)
116100 options.merge!(httparty) if httparty
117101 end
118102 end
6262
6363 # Execute a given command with arguements
6464 def execute(cmd=command, args=arguments)
65 if actions.include?(cmd.to_sym)
66 confirm_command(cmd)
67 gitlab_helper(cmd, args)
68 else
69 fail "Unknown command: #{cmd}. " \
70 "See the 'help' for a list of valid commands."
71 end
65 raise "Unknown command: #{cmd}. See the 'help' for a list of valid commands." unless actions.include?(cmd.to_sym)
66
67 confirm_command(cmd)
68 gitlab_helper(cmd, args)
7269 end
7370
7471 def quit_shell
7976 def history
8077 @history ||= History.new
8178 end
82 end # class << self
79 end
8380 end
00 module Gitlab
1 VERSION = "4.2.0"
1 VERSION = '4.5.0'.freeze
22 end
2525 end
2626
2727 # Delegate to Gitlab::Client
28 def respond_to_missing?(method_name, include_private = false)
28 def self.respond_to_missing?(method_name, include_private=false)
2929 client.respond_to?(method_name) || super
3030 end
3131
3838 #
3939 # @return [Array<Symbol>]
4040 def self.actions
41 hidden = /endpoint|private_token|auth_token|user_agent|sudo|get|post|put|\Adelete\z|validate|set_request_defaults|httparty/
41 hidden = /endpoint|private_token|auth_token|user_agent|sudo|get|post|put|\Adelete\z|validate|request_defaults|httparty/
4242 (Gitlab::Client.instance_methods - Object.methods).reject { |e| e[hidden] }
4343 end
4444 end
+0
-1
spec/fixtures/board_list.json less more
0 { "id" : 1, "label" : { "name" : "Testing", "color" : "#F0AD4E", "description" : null }, "position" : 1 }
+0
-1
spec/fixtures/board_lists.json less more
0 [ { "id" : 1, "label" : { "name" : "Testing", "color" : "#F0AD4E", "description" : null }, "position" : 1 }, { "id" : 2, "label" : { "name" : "Ready", "color" : "#FF0000", "description" : null }, "position" : 2 }, { "id" : 3, "label" : { "name" : "Production", "color" : "#FF5F00", "description" : null }, "position" : 3 } ]
+0
-1
spec/fixtures/boards.json less more
0 [ { "id" : 1, "lists" : [ { "id" : 1, "label" : { "name" : "Testing", "color" : "#F0AD4E", "description" : null }, "position" : 1 }, { "id" : 2, "label" : { "name" : "Ready", "color" : "#FF0000", "description" : null }, "position" : 2 }, { "id" : 3, "label" : { "name" : "Production", "color" : "#FF5F00", "description" : null }, "position" : 3 } ] } ]
+0
-1
spec/fixtures/branch.json less more
0 {"name":"api","commit":{"id":"f7dd067490fe57505f7226c3b54d3127d2f7fd46","parents":[{"id":"949b1df930bedace1dbd755aaa4a82e8c451a616"}],"tree":"f8c4b21c036339f92fcc5482aa28a41250553b27","message":"API: expose issues project id","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-07-25T04:22:21-07:00","committed_date":"2012-07-25T04:22:21-07:00"},"protected": true}
+0
-3
spec/fixtures/branch_delete.json less more
0 {
1 "branch_name": "api"
2 }
+0
-1
spec/fixtures/branches.json less more
0 [{"name":"api","commit":{"id":"f7dd067490fe57505f7226c3b54d3127d2f7fd46","parents":[{"id":"949b1df930bedace1dbd755aaa4a82e8c451a616"}],"tree":"f8c4b21c036339f92fcc5482aa28a41250553b27","message":"API: expose issues project id","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-07-25T04:22:21-07:00","committed_date":"2012-07-25T04:22:21-07:00"}},{"name":"dashboard-feed","commit":{"id":"f8f6ff065eccc6ede4d35ed87a09bb962b84ca25","parents":[{"id":"2cf8010792c3075824ee27d0f037aeb178cbbf7e"}],"tree":"e17f2157143d550891d4669c10b7446e4739bc6d","message":"add projects atom feed","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-05-31T23:42:02-07:00","committed_date":"2012-05-31T23:42:02-07:00"}},{"name":"master","commit":{"id":"2cf8010792c3075824ee27d0f037aeb178cbbf7e","parents":[{"id":"af226ae9c9af406c8a0e0bbdf364563495c2f432"},{"id":"e851cb07762aa464aae10e8b4b28de87c1a6f925"}],"tree":"6c6845838039f01723d91f395a1d2fa1dcc82522","message":"Merge pull request #868 from SaitoWu/bugfix/encoding\n\nBugfix/encoding","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-05-30T00:24:43-07:00","committed_date":"2012-05-30T00:24:43-07:00"}},{"name":"preview_notes","commit":{"id":"3749e0d99ac6bfbc65889b1b7a5310e14e7fe89a","parents":[{"id":"2483181f2c3d4ea7d2c68147b19bc07fc3937b0c"}],"tree":"f8c56161b0d6561568f088df9961362eb1ece88b","message":"pass project_id to notes preview path","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-08-09T23:46:27-07:00","committed_date":"2012-08-09T23:46:27-07:00"}},{"name":"refactoring","commit":{"id":"7c7761099cae83f59fe5780340e100be890847b2","parents":[{"id":"058d80b3363dd4fc4417ca4f60f76119188a2470"}],"tree":"d7d4a94c700dc0e84ee943019213d2358a49c413","message":"fix deprecation warnings","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-05-29T07:16:28-07:00","committed_date":"2012-05-29T07:16:28-07:00"}}]
+0
-38
spec/fixtures/build.json less more
0 {
1 "commit": {
2 "author_email": "admin@example.com",
3 "author_name": "Administrator",
4 "created_at": "2015-12-24T16:51:14.000+01:00",
5 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
6 "message": "Test the CI integration.",
7 "short_id": "0ff3ae19",
8 "title": "Test the CI integration."
9 },
10 "coverage": null,
11 "created_at": "2015-12-24T15:51:21.880Z",
12 "download_url": null,
13 "finished_at": "2015-12-24T17:54:31.198Z",
14 "id": 8,
15 "name": "rubocop",
16 "ref": "master",
17 "runner": null,
18 "stage": "test",
19 "started_at": "2015-12-24T17:54:30.733Z",
20 "status": "failed",
21 "tag": false,
22 "user": {
23 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
24 "bio": null,
25 "created_at": "2015-12-21T13:14:24.077Z",
26 "id": 1,
27 "is_admin": true,
28 "linkedin": "",
29 "name": "John Smith",
30 "skype": "",
31 "state": "active",
32 "twitter": "",
33 "username": "root",
34 "web_url": "http://gitlab.dev/u/root",
35 "website_url": ""
36 }
37 }
spec/fixtures/build_artifacts.json less more
Binary diff not shown
+0
-24
spec/fixtures/build_cancel.json less more
0 {
1 "commit": {
2 "author_email": "admin@example.com",
3 "author_name": "John Smith",
4 "created_at": "2015-12-24T16:51:14.000+01:00",
5 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
6 "message": "Test the CI integration.",
7 "short_id": "0ff3ae19",
8 "title": "Test the CI integration."
9 },
10 "coverage": null,
11 "created_at": "2016-01-11T10:13:33.506Z",
12 "download_url": null,
13 "finished_at": "2016-01-11T10:14:09.526Z",
14 "id": 69,
15 "name": "rubocop",
16 "ref": "master",
17 "runner": null,
18 "stage": "test",
19 "started_at": null,
20 "status": "canceled",
21 "tag": false,
22 "user": null
23 }
+0
-24
spec/fixtures/build_erase.json less more
0 {
1 "commit": {
2 "author_email": "admin@example.com",
3 "author_name": "John Smith",
4 "created_at": "2015-12-24T16:51:14.000+01:00",
5 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
6 "message": "Test the CI integration.",
7 "short_id": "0ff3ae19",
8 "title": "Test the CI integration."
9 },
10 "coverage": null,
11 "download_url": null,
12 "id": 69,
13 "name": "rubocop",
14 "ref": "master",
15 "runner": null,
16 "stage": "test",
17 "created_at": "2016-01-11T10:13:33.506Z",
18 "started_at": "2016-01-11T10:13:33.506Z",
19 "finished_at": "2016-01-11T10:15:10.506Z",
20 "status": "failed",
21 "tag": false,
22 "user": null
23 }
+0
-24
spec/fixtures/build_retry.json less more
0 {
1 "commit": {
2 "author_email": "admin@example.com",
3 "author_name": "John Smith",
4 "created_at": "2015-12-24T16:51:14.000+01:00",
5 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
6 "message": "Test the CI integration.",
7 "short_id": "0ff3ae19",
8 "title": "Test the CI integration."
9 },
10 "coverage": null,
11 "created_at": "2016-01-11T10:13:33.506Z",
12 "download_url": null,
13 "finished_at": null,
14 "id": 69,
15 "name": "rubocop",
16 "ref": "master",
17 "runner": null,
18 "stage": "test",
19 "started_at": null,
20 "status": "pending",
21 "tag": false,
22 "user": null
23 }
+0
-78
spec/fixtures/builds.json less more
0 [
1 {
2 "commit": {
3 "author_email": "admin@example.com",
4 "author_name": "Administrator",
5 "created_at": "2015-12-24T16:51:14.000+01:00",
6 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
7 "message": "Test the CI integration.",
8 "short_id": "0ff3ae19",
9 "title": "Test the CI integration."
10 },
11 "coverage": null,
12 "created_at": "2015-12-24T15:51:21.802Z",
13 "download_url": null,
14 "finished_at": "2015-12-24T17:54:27.895Z",
15 "id": 7,
16 "name": "teaspoon",
17 "ref": "master",
18 "runner": null,
19 "stage": "test",
20 "started_at": "2015-12-24T17:54:27.722Z",
21 "status": "failed",
22 "tag": false,
23 "user": {
24 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
25 "bio": null,
26 "created_at": "2015-12-21T13:14:24.077Z",
27 "id": 1,
28 "is_admin": true,
29 "linkedin": "",
30 "name": "Administrator",
31 "skype": "",
32 "state": "active",
33 "twitter": "",
34 "username": "root",
35 "web_url": "http://gitlab.dev/u/root",
36 "website_url": ""
37 }
38 },
39 {
40 "commit": {
41 "author_email": "admin@example.com",
42 "author_name": "Administrator",
43 "created_at": "2015-12-24T16:51:14.000+01:00",
44 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
45 "message": "Test the CI integration.",
46 "short_id": "0ff3ae19",
47 "title": "Test the CI integration."
48 },
49 "coverage": null,
50 "created_at": "2015-12-24T15:51:21.727Z",
51 "download_url": null,
52 "finished_at": "2015-12-24T17:54:24.921Z",
53 "id": 6,
54 "name": "spinach:other",
55 "ref": "master",
56 "runner": null,
57 "stage": "test",
58 "started_at": "2015-12-24T17:54:24.729Z",
59 "status": "failed",
60 "tag": false,
61 "user": {
62 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
63 "bio": null,
64 "created_at": "2015-12-21T13:14:24.077Z",
65 "id": 1,
66 "is_admin": true,
67 "linkedin": "",
68 "name": "Administrator",
69 "skype": "",
70 "state": "active",
71 "twitter": "",
72 "username": "root",
73 "web_url": "http://gitlab.dev/u/root",
74 "website_url": ""
75 }
76 }
77 ]
+0
-64
spec/fixtures/builds_commits.json less more
0 [
1 {
2 "commit": {
3 "author_email": "admin@example.com",
4 "author_name": "Administrator",
5 "created_at": "2015-12-24T16:51:14.000+01:00",
6 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
7 "message": "Test the CI integration.",
8 "short_id": "0ff3ae19",
9 "title": "Test the CI integration."
10 },
11 "coverage": null,
12 "created_at": "2016-01-11T10:13:33.506Z",
13 "download_url": null,
14 "finished_at": "2016-01-11T10:14:09.526Z",
15 "id": 69,
16 "name": "rubocop",
17 "ref": "master",
18 "runner": null,
19 "stage": "test",
20 "started_at": null,
21 "status": "canceled",
22 "tag": false,
23 "user": null
24 },
25 {
26 "commit": {
27 "author_email": "admin@example.com",
28 "author_name": "Administrator",
29 "created_at": "2015-12-24T16:51:14.000+01:00",
30 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
31 "message": "Test the CI integration.",
32 "short_id": "0ff3ae19",
33 "title": "Test the CI integration."
34 },
35 "coverage": null,
36 "created_at": "2015-12-24T15:51:21.957Z",
37 "download_url": null,
38 "finished_at": "2015-12-24T17:54:33.913Z",
39 "id": 9,
40 "name": "brakeman",
41 "ref": "master",
42 "runner": null,
43 "stage": "test",
44 "started_at": "2015-12-24T17:54:33.727Z",
45 "status": "failed",
46 "tag": false,
47 "user": {
48 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
49 "bio": null,
50 "created_at": "2015-12-21T13:14:24.077Z",
51 "id": 1,
52 "is_admin": true,
53 "linkedin": "",
54 "name": "Administrator",
55 "skype": "",
56 "state": "active",
57 "twitter": "",
58 "username": "root",
59 "web_url": "http://gitlab.dev/u/root",
60 "website_url": ""
61 }
62 }
63 ]
+0
-31
spec/fixtures/compare_merge_request_diff.json less more
0
1 {
2 "commit": {
3 "id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1",
4 "short_id": "12d65c8dd2b",
5 "title": "JS fix",
6 "author_name": "Dmitriy Zaporozhets",
7 "author_email": "dmitriy.zaporozhets@gmail.com",
8 "created_at": "2014-02-27T10:27:00+02:00"
9 },
10 "commits": [{
11 "id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1",
12 "short_id": "12d65c8dd2b",
13 "title": "JS fix",
14 "author_name": "Dmitriy Zaporozhets",
15 "author_email": "dmitriy.zaporozhets@gmail.com",
16 "created_at": "2014-02-27T10:27:00+02:00"
17 }],
18 "diffs": [{
19 "old_path": "files/js/application.js",
20 "new_path": "files/js/application.js",
21 "a_mode": null,
22 "b_mode": "100644",
23 "diff": "--- a/files/js/application.js\n+++ b/files/js/application.js\n@@ -24,8 +24,10 @@\n //= require g.raphael-min\n //= require g.bar-min\n //= require branch-graph\n-//= require highlightjs.min\n-//= require ace/ace\n //= require_tree .\n //= require d3\n //= require underscore\n+\n+function fix() { \n+ alert(\"Fixed\")\n+}",
24 "new_file": false,
25 "renamed_file": false,
26 "deleted_file": false
27 }],
28 "compare_timeout": false,
29 "compare_same_ref": false
30 }
+0
-0
spec/fixtures/empty.json less more
(Empty file)
+0
-6
spec/fixtures/environment.json less more
0 {
1 "id": 12,
2 "name": "staging",
3 "slug": "staging-cb247rv",
4 "external_url": "https://staging.example.gitlab.com"
5 }
+0
-14
spec/fixtures/environments.json less more
0 [
1 {
2 "id": 1,
3 "name": "review/fix-foo",
4 "slug": "review-fix-foo-dfjre3",
5 "external_url": "https://review-fix-foo-dfjre3.example.gitlab.com"
6 },
7 {
8 "id": 12,
9 "name": "review/fix-bar",
10 "slug": "review-fix-bar-dbwr18",
11 "external_url": "https://review-fix-bar-dbwr18.example.gitlab.com"
12 }
13 ]
+0
-1
spec/fixtures/error_already_exists.json less more
0 {"message": "409 Already exists"}
+0
-1
spec/fixtures/error_project_not_found.json less more
0 {"message": "404 Project Not Found"}
+0
-1
spec/fixtures/get_repository_file.json less more
0 {"file_name":"README.md", "file_path":"README.md", "size":"19", "encoding":"base64", "content":"VGhpcyBpcyBhICpSRUFETUUqIQ==\n", "ref":"master", "blob_id":"0eba9dff767611060181e0423a1de2941d27efc8", "commit_id":"eb38397cb6ae669219e6bc18ad19981fff18ea29"}
+0
-60
spec/fixtures/group.json less more
0 {"id": 10, "name": "GitLab-Group", "path": "gitlab-group", "owner_id": 6, "projects": [
1 {
2 "id": 9,
3 "name": "mojito",
4 "description": null,
5 "default_branch": "master",
6 "owner": {
7 "id": 6,
8 "username": "jose",
9 "email": "jose@abc.com",
10 "name": "Jose Jose",
11 "blocked": false,
12 "created_at": "2013-02-06T06:54:06Z"
13 },
14 "path": "mojito",
15 "path_with_namespace": "gitlab-group/mojito",
16 "issues_enabled": true,
17 "merge_requests_enabled": true,
18 "wall_enabled": true,
19 "wiki_enabled": true,
20 "created_at": "2013-02-06T16:59:15Z",
21 "namespace": {
22 "created_at": "2013-02-06T16:58:22Z",
23 "id": 10,
24 "name": "GitLab-Group",
25 "owner_id": 6,
26 "path": "gitlab-group",
27 "updated_at": "2013-02-06T16:58:22Z"
28 }
29 },
30 {
31 "id": 10,
32 "name": "gitlabhq",
33 "description": null,
34 "default_branch": null,
35 "owner": {
36 "id": 6,
37 "username": "randx",
38 "email": "randx@github.com",
39 "name": "Dmitry Z",
40 "blocked": false,
41 "created_at": "2013-02-06T06:54:06Z"
42 },
43 "path": "gitlabhq",
44 "path_with_namespace": "gitlab-group/gitlabhq",
45 "issues_enabled": true,
46 "merge_requests_enabled": true,
47 "wall_enabled": true,
48 "wiki_enabled": true,
49 "created_at": "2013-02-06T17:02:31Z",
50 "namespace": {
51 "created_at": "2013-02-06T16:58:22Z",
52 "id": 10,
53 "name": "GitLab-Group",
54 "owner_id": 6,
55 "path": "gitlab-group",
56 "updated_at": "2013-02-06T16:58:22Z"
57 }
58 }
59 ]}
+0
-1
spec/fixtures/group_create.json less more
0 {"id":3,"name":"Gitlab-Group","path":"gitlab-group","owner_id":1}
+0
-1
spec/fixtures/group_create_with_description.json less more
0 {"id":3,"name":"Gitlab-Group","path":"gitlab-group","owner_id":1,"description":"gitlab group description"}
+0
-1
spec/fixtures/group_delete.json less more
0 {"id":42,"name":"Gitlab-Group","path":"gitlab-group","created_at":"2016-02-24T20:16:42.906Z","updated_at":"2016-02-24T20:16:42.906Z"}
+0
-1
spec/fixtures/group_member.json less more
0 {"id":2,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-09-04T18:15:30Z","access_level":10}
+0
-1
spec/fixtures/group_member_delete.json less more
0 {"created_at":"2013-09-04T18:18:15Z","group_access":10,"group_id":3,"id":2,"notification_level":3,"updated_at":"2013-09-04T18:18:15Z","user_id":2}
+0
-1
spec/fixtures/group_member_edit.json less more
0 {"id":2,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-09-04T18:15:30Z","access_level":50}
+0
-1
spec/fixtures/group_members.json less more
0 [{"id":1,"username":"eraymond","email":"eraymond@local.host","name":"Edward Raymond","state":"active","created_at":"2013-08-30T16:16:22Z","access_level":50},{"id":1,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-08-30T16:16:22Z","access_level":50}]
+0
-44
spec/fixtures/group_projects.json less more
0 [
1 {
2 "id": 4,
3 "description": null,
4 "default_branch": "master",
5 "public": false,
6 "visibility_level": 0,
7 "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
8 "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
9 "web_url": "http://example.com/diaspora/diaspora-client",
10 "tag_list": [
11 "example",
12 "disapora client"
13 ],
14 "owner": {
15 "id": 3,
16 "name": "Diaspora",
17 "created_at": "2013-09-30T13: 46: 02Z"
18 },
19 "name": "Diaspora Client",
20 "name_with_namespace": "Diaspora / Diaspora Client",
21 "path": "diaspora-client",
22 "path_with_namespace": "diaspora/diaspora-client",
23 "issues_enabled": true,
24 "merge_requests_enabled": true,
25 "builds_enabled": true,
26 "wiki_enabled": true,
27 "snippets_enabled": false,
28 "created_at": "2013-09-30T13: 46: 02Z",
29 "last_activity_at": "2013-09-30T13: 46: 02Z",
30 "creator_id": 3,
31 "namespace": {
32 "created_at": "2013-09-30T13: 46: 02Z",
33 "description": "",
34 "id": 3,
35 "name": "Diaspora",
36 "owner_id": 1,
37 "path": "diaspora",
38 "updated_at": "2013-09-30T13: 46: 02Z"
39 },
40 "archived": false,
41 "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png"
42 }
43 ]
+0
-2
spec/fixtures/group_search.json less more
0 [{"id": 5,"name": "Five-Group","path": "five-group","owner_id": 2},{"id": 8,"name": "Eight Group","path": "eight-group","owner_id": 6}
1 ]
+0
-2
spec/fixtures/groups.json less more
0 [{"id": 3,"name": "ThreeGroup","path": "threegroup","owner_id": 1},{"id": 5,"name": "Five-Group","path": "five-group","owner_id": 2},{"id": 8,"name": "Eight Group","path": "eight-group","owner_id": 6}
1 ]
+0
-1
spec/fixtures/issue.json less more
0 {"id":33,"project_id":3,"title":"Beatae possimus nostrum nihil reiciendis laboriosam nihil delectus alias accusantium dolor unde.","description":null,"labels":[],"milestone":null,"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}
+0
-16
spec/fixtures/issue_award_emoji.json less more
0 {
1 "id": 4,
2 "name": "blowfish",
3 "user": {
4 "name": "Administrator",
5 "username": "root",
6 "id": 1,
7 "state": "active",
8 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
9 "web_url": "http://gitlab.example.com/root"
10 },
11 "created_at": "2016-06-15T10:09:34.206Z",
12 "updated_at": "2016-06-15T10:09:34.206Z",
13 "awardable_id": 80,
14 "awardable_type": "Issue"
15 }
+0
-34
spec/fixtures/issue_award_emojis.json less more
0 [
1 {
2 "id": 4,
3 "name": "1234",
4 "user": {
5 "name": "Administrator",
6 "username": "root",
7 "id": 1,
8 "state": "active",
9 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
10 "web_url": "http://gitlab.example.com/root"
11 },
12 "created_at": "2016-06-15T10:09:34.206Z",
13 "updated_at": "2016-06-15T10:09:34.206Z",
14 "awardable_id": 80,
15 "awardable_type": "Issue"
16 },
17 {
18 "id": 1,
19 "name": "microphone",
20 "user": {
21 "name": "User 4",
22 "username": "user4",
23 "id": 26,
24 "state": "active",
25 "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
26 "web_url": "http://gitlab.example.com/user4"
27 },
28 "created_at": "2016-06-15T10:09:34.177Z",
29 "updated_at": "2016-06-15T10:09:34.177Z",
30 "awardable_id": 80,
31 "awardable_type": "Issue"
32 }
33 ]
+0
-1
spec/fixtures/issues.json less more
0 [{"id":1,"project_id":1,"title":"Culpa eius recusandae suscipit autem distinctio dolorum.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":6,"project_id":2,"title":"Ut in dolorum omnis sed sit aliquam.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":12,"project_id":3,"title":"Veniam et tempore quidem eum reprehenderit cupiditate non aut velit eaque.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":21,"project_id":1,"title":"Vitae ea aliquam et quo eligendi sapiente voluptatum labore hic nihil culpa.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":26,"project_id":2,"title":"Quo enim est nihil atque placeat voluptas neque eos voluptas.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":32,"project_id":3,"title":"Deserunt tenetur impedit est beatae voluptas voluptas quaerat quisquam.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}]
+0
-43
spec/fixtures/job.json less more
0 {
1 "commit": {
2 "author_email": "admin@example.com",
3 "author_name": "Administrator",
4 "created_at": "2015-12-24T16:51:14.000+01:00",
5 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
6 "message": "Test the CI integration.",
7 "short_id": "0ff3ae19",
8 "title": "Test the CI integration."
9 },
10 "coverage": null,
11 "created_at": "2015-12-24T15:51:21.880Z",
12 "artifacts_file": null,
13 "finished_at": "2015-12-24T17:54:31.198Z",
14 "id": 8,
15 "name": "rubocop",
16 "pipeline": {
17 "id": 6,
18 "ref": "master",
19 "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
20 "status": "pending"
21 },
22 "ref": "master",
23 "runner": null,
24 "stage": "test",
25 "started_at": "2015-12-24T17:54:30.733Z",
26 "status": "failed",
27 "tag": false,
28 "user": {
29 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
30 "bio": null,
31 "created_at": "2015-12-21T13:14:24.077Z",
32 "id": 1,
33 "linkedin": "",
34 "name": "Administrator",
35 "skype": "",
36 "state": "active",
37 "twitter": "",
38 "username": "root",
39 "web_url": "http://gitlab.dev/root",
40 "website_url": ""
41 }
42 }
+0
-1
spec/fixtures/job_trace.json less more
0 asdasd
+0
-91
spec/fixtures/jobs.json less more
0 [
1 {
2 "commit": {
3 "author_email": "admin@example.com",
4 "author_name": "Administrator",
5 "created_at": "2015-12-24T16:51:14.000+01:00",
6 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
7 "message": "Test the CI integration.",
8 "short_id": "0ff3ae19",
9 "title": "Test the CI integration."
10 },
11 "coverage": null,
12 "created_at": "2015-12-24T15:51:21.802Z",
13 "artifacts_file": {
14 "filename": "artifacts.zip",
15 "size": 1000
16 },
17 "finished_at": "2015-12-24T17:54:27.895Z",
18 "id": 7,
19 "name": "teaspoon",
20 "pipeline": {
21 "id": 6,
22 "ref": "master",
23 "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
24 "status": "pending"
25 },
26 "ref": "master",
27 "runner": null,
28 "stage": "test",
29 "started_at": "2015-12-24T17:54:27.722Z",
30 "status": "failed",
31 "tag": false,
32 "user": {
33 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
34 "bio": null,
35 "created_at": "2015-12-21T13:14:24.077Z",
36 "id": 1,
37 "linkedin": "",
38 "name": "Administrator",
39 "skype": "",
40 "state": "active",
41 "twitter": "",
42 "username": "root",
43 "web_url": "http://gitlab.dev/root",
44 "website_url": ""
45 }
46 },
47 {
48 "commit": {
49 "author_email": "admin@example.com",
50 "author_name": "Administrator",
51 "created_at": "2015-12-24T16:51:14.000+01:00",
52 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
53 "message": "Test the CI integration.",
54 "short_id": "0ff3ae19",
55 "title": "Test the CI integration."
56 },
57 "coverage": null,
58 "created_at": "2015-12-24T15:51:21.727Z",
59 "artifacts_file": null,
60 "finished_at": "2015-12-24T17:54:24.921Z",
61 "id": 6,
62 "name": "spinach:other",
63 "pipeline": {
64 "id": 6,
65 "ref": "master",
66 "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
67 "status": "pending"
68 },
69 "ref": "master",
70 "runner": null,
71 "stage": "test",
72 "started_at": "2015-12-24T17:54:24.729Z",
73 "status": "failed",
74 "tag": false,
75 "user": {
76 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
77 "bio": null,
78 "created_at": "2015-12-21T13:14:24.077Z",
79 "id": 1,
80 "linkedin": "",
81 "name": "Administrator",
82 "skype": "",
83 "state": "active",
84 "twitter": "",
85 "username": "root",
86 "web_url": "http://gitlab.dev/root",
87 "website_url": ""
88 }
89 }
90 ]
+0
-1
spec/fixtures/key.json less more
0 {"id":1,"title":"narkoz@helium","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkUsh42Nh1yefGd1jbSELn5XsY8p5Oxmau0/1HqHnjuYOaj5X+kHccFDwtmtg9Ox8ua/+WptNsiE8IUwsD3zKgEjajgwq3gMeeFdxfXwM+tEvHOOMV9meRrgRWGYCToPbT6sR7/YMAYa7cPqWSpx/oZhYfz4XtoMv3ZZT1fZMmx3MY3HwXwW8j+obJyN2K4LN0TFi9RPgWWYn0DCyb9OccmABimt3i74WoJ/OT8r6/7swce8+OSe0Q2wBhyTtvxg2vtUcoek8Af+EZaUMBwSEzEsocOCzwQvjF5XUk5o7dJ8nP8W3RE60JWX57t16eQm7lBmumLYfszpn2isd6W7a1 narkoz@helium"}
+0
-1
spec/fixtures/keys.json less more
0 [{"id":1,"title":"narkoz@helium","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkUsh42Nh1yefGd1jbSELn5XsY8p5Oxmau0/1HqHnjuYOaj5X+kHccFDwtmtg9Ox8ua/+WptNsiE8IUwsD3zKgEjajgwq3gMeeFdxfXwM+tEvHOOMV9meRrgRWGYCToPbT6sR7/YMAYa7cPqWSpx/oZhYfz4XtoMv3ZZT1fZMmx3MY3HwXwW8j+obJyN2K4LN0TFi9RPgWWYn0DCyb9OccmABimt3i74WoJ/OT8r6/7swce8+OSe0Q2wBhyTtvxg2vtUcoek8Af+EZaUMBwSEzEsocOCzwQvjF5XUk5o7dJ8nP8W3RE60JWX57t16eQm7lBmumLYfszpn2isd6W7a1 narkoz@helium"}]
+0
-1
spec/fixtures/label.json less more
0 {"name": "Backlog", "color": "#DD10AA", "subscribed": true}
+0
-1
spec/fixtures/label_unsubscribe.json less more
0 {"name": "Backlog", "color": "#DD10AA", "subscribed": false}
+0
-1
spec/fixtures/labels.json less more
0 [{"name": "Backlog", "color": "#DD10AA"},{"name": "Documentation", "color": "#1E80DD"}]
+0
-1
spec/fixtures/merge_request.json less more
0 {"id":1,"target_branch":"master","source_branch":"api","project_id":3,"title":"New feature","closed":false,"merged":false,"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-10-19T05:56:14Z"}}
+0
-16
spec/fixtures/merge_request_award_emoji.json less more
0 {
1 "id": 4,
2 "name": "blowfish",
3 "user": {
4 "name": "Administrator",
5 "username": "root",
6 "id": 1,
7 "state": "active",
8 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
9 "web_url": "http://gitlab.example.com/root"
10 },
11 "created_at": "2016-06-15T10:09:34.206Z",
12 "updated_at": "2016-06-15T10:09:34.206Z",
13 "awardable_id": 80,
14 "awardable_type": "MergeRequest"
15 }
+0
-34
spec/fixtures/merge_request_award_emojis.json less more
0 [
1 {
2 "id": 4,
3 "name": "1234",
4 "user": {
5 "name": "Administrator",
6 "username": "root",
7 "id": 1,
8 "state": "active",
9 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
10 "web_url": "http://gitlab.example.com/root"
11 },
12 "created_at": "2016-06-15T10:09:34.206Z",
13 "updated_at": "2016-06-15T10:09:34.206Z",
14 "awardable_id": 80,
15 "awardable_type": "MergeRequest"
16 },
17 {
18 "id": 1,
19 "name": "microphone",
20 "user": {
21 "name": "User 4",
22 "username": "user4",
23 "id": 26,
24 "state": "active",
25 "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
26 "web_url": "http://gitlab.example.com/user4"
27 },
28 "created_at": "2016-06-15T10:09:34.177Z",
29 "updated_at": "2016-06-15T10:09:34.177Z",
30 "awardable_id": 80,
31 "awardable_type": "MergeRequest"
32 }
33 ]
+0
-1
spec/fixtures/merge_request_changes.json less more
0 {"id":2,"iid":5,"project_id":3,"title":"Uncovered","description":"","state":"opened","created_at":"2015-03-15T23:15:13.292+01:00","updated_at":"2015-03-15T23:15:14.132+01:00","target_branch":"master","source_branch":"uncovered","upvotes":0,"downvotes":0,"author":{"name":"Dominik Sander","username":"dsander","id":1,"state":"active","avatar_url":"https://secure.gravatar.com/avatar/7f01734389dd6730d076ddee04838bd3?s=40\u0026d=identicon"},"assignee":null,"source_project_id":6,"target_project_id":6,"labels":[],"milestone":null,"changes":[{"old_path":"lib/omniauth/builder.rb","new_path":"lib/omniauth/builder.rb","a_mode":"100644","b_mode":"100644","diff":"--- a/lib/omniauth/builder.rb\n+++ b/lib/omniauth/builder.rb\n@@ -7,11 +7,13 @@ module OmniAuth\n else\n @app = app\n super(\u0026block)\n+ two = 1 # woah! uncovered\n @ins \u003c\u003c @app\n end\n end\n \n def rack14?\n+ one = 2 # thats oke!\n Rack.release.split('.')[1].to_i \u003e= 4\n end\n ","new_file":false,"renamed_file":false,"deleted_file":false}]}
+0
-1
spec/fixtures/merge_request_closes_issues.json less more
0 [{"id":1,"iid":1,"project_id":5,"title":"Merge request 1 issue 1","description":"","state":"opened","created_at":"2017-04-06T08:03:36.163Z","updated_at":"2017-04-06T08:03:57.087Z","labels":[],"milestone":null,"assignee":null,"author":{"name":"John","username":"jdoe","id":1,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoe"},"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/issues/1"},{"id":2,"iid":2,"project_id":5,"title":"Merge request 1 issue 2","description":"","state":"opened","created_at":"2017-04-06T08:03:44.023Z","updated_at":"2017-04-06T08:03:44.023Z","labels":[],"milestone":null,"assignee":null,"author":{"name":"John","username":"jdoe","id":426047,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoe"},"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/issues/2"}]
+0
-1
spec/fixtures/merge_request_comment.json less more
0 {"note":"Cool Merge Request!","author":{"id":1,"username":"jsmith","email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-07-11T01:32:18Z"}}
+0
-1
spec/fixtures/merge_request_comments.json less more
0 [{"note":"this is the 1st comment on the 2merge merge request","author":{"id":11,"username":"admin","email":"admin@example.com","name":"A User","state":"active","created_at":"2014-03-06T08:17:35.000Z"}},{"note":"another discussion point on the 2merge request","author":{"id":12,"username":"admin","email":"admin@example.com","name":"A User","state":"active","created_at":"2014-03-06T08:17:35.000Z"}}]
+0
-1
spec/fixtures/merge_request_commits.json less more
0 [{"id":"a2da7552f26d5b46a6a09bb8b7b066e3a102be7d","short_id":"a2da7552","title": "piyo","author_name":"example","author_email":"example@example.com","created_at":"2015-12-19T18:02:31.000+09:00","message":"fuga"},{"id":"3ce509590f37dbce5b877c3e1c78bd3903493170","short_id":"3ce50959","title":"hoge","author_name":"example","author_email":"example@example.com","created_at":"2015-12-19T17:53:46.000+09:00","message":"Hoge"}]
+0
-1
spec/fixtures/merge_requests.json less more
0 [{"id":1,"target_branch":"master","source_branch":"api","project_id":3,"title":"New feature","closed":false,"merged":false,"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-10-19T05:56:14Z"}}]
+0
-1
spec/fixtures/milestone.json less more
0 {"id":1,"project_id":3,"title":"3.0","description":"","due_date":"2012-10-22","closed":false,"updated_at":"2012-09-17T10:15:31Z","created_at":"2012-09-17T10:15:31Z"}
+0
-1
spec/fixtures/milestone_issues.json less more
0 [{"id":1,"project_id":3,"title":"Culpa eius recusandae suscipit autem distinctio dolorum.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":6,"project_id":3,"title":"Ut in dolorum omnis sed sit aliquam.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":12,"project_id":3,"title":"Veniam et tempore quidem eum reprehenderit cupiditate non aut velit eaque.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":21,"project_id":3,"title":"Vitae ea aliquam et quo eligendi sapiente voluptatum labore hic nihil culpa.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":26,"project_id":3,"title":"Quo enim est nihil atque placeat voluptas neque eos voluptas.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":32,"project_id":3,"title":"Deserunt tenetur impedit est beatae voluptas voluptas quaerat quisquam.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}]
+0
-1
spec/fixtures/milestone_merge_requests.json less more
0 [{"id":1,"iid":1,"project_id":1,"title":"lorem ipsum","description":"","state":"opened","created_at":"2017-03-24T12:23:53.918Z","updated_at":"2017-03-24T12:23:53.918Z","target_branch":"master","source_branch":"def","upvotes":0,"downvotes":0,"author":{"name":"John Doe","username":"jdoe","id":1,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoen"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":{"id":1,"iid":1,"project_id":1,"title":"Test","description":"","state":"active","created_at":"2017-03-24T12:23:00.560Z","updated_at":"2017-03-24T12:23:00.560Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"aec123d1775790b2347fdd684b5ba613fdeb994b","merge_commit_sha":null,"user_notes_count":0,"approvals_before_merge":null,"should_remove_source_branch":null,"force_remove_source_branch":false,"squash":false,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/merge_requests/2"},{"id":2,"iid":2,"project_id":1,"title":"ipsum lorem","description":"","state":"opened","created_at":"2017-03-24T12:23:24.662Z","updated_at":"2017-03-24T12:23:33.522Z","target_branch":"master","source_branch":"test1","upvotes":0,"downvotes":0,"author":{"name":"Joren","username":"jdoe","id":1,"state":"active","":"","web_url":"https://gitlab.com/jdoe"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":{"id":1,"iid":1,"project_id":1,"title":"Test","description":"","state":"active","created_at":"2017-03-24T12:23:00.560Z","updated_at":"2017-03-24T12:23:00.560Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"3ee44c9b40deddae596f838b97523c6f010fd80d","merge_commit_sha":null,"user_notes_count":0,"approvals_before_merge":null,"should_remove_source_branch":null,"force_remove_source_branch":true,"squash":false,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/merge_requests/1"}]
+0
-1
spec/fixtures/milestones.json less more
0 [{"id":1,"project_id":3,"title":"3.0","description":"","due_date":"2012-10-22","closed":false,"updated_at":"2012-09-17T10:15:31Z","created_at":"2012-09-17T10:15:31Z"}]
+0
-1
spec/fixtures/namespaces.json less more
0 [{"id": 1, "path": "john", "kind": "user"}]
+0
-1
spec/fixtures/note.json less more
0 {"id":1201,"body":"The solution is rather tricky","author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"created_at":"2012-11-27T19:16:44Z"}
+0
-16
spec/fixtures/note_award_emoji.json less more
0 {
1 "id": 4,
2 "name": "mood_bubble_lightning",
3 "user": {
4 "name": "User 4",
5 "username": "user4",
6 "id": 26,
7 "state": "active",
8 "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
9 "web_url": "http://gitlab.example.com/user4"
10 },
11 "created_at": "2016-06-15T10:09:34.197Z",
12 "updated_at": "2016-06-15T10:09:34.197Z",
13 "awardable_id": 1,
14 "awardable_type": "Note"
15 }
+0
-18
spec/fixtures/note_award_emojis.json less more
0 [
1 {
2 "id": 2,
3 "name": "mood_bubble_lightning",
4 "user": {
5 "name": "User 4",
6 "username": "user4",
7 "id": 26,
8 "state": "active",
9 "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
10 "web_url": "http://gitlab.example.com/user4"
11 },
12 "created_at": "2016-06-15T10:09:34.197Z",
13 "updated_at": "2016-06-15T10:09:34.197Z",
14 "awardable_id": 1,
15 "awardable_type": "Note"
16 }
17 ]
+0
-1
spec/fixtures/notes.json less more
0 [{"id":1201,"body":"The solution is rather tricky","author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"created_at":"2012-11-27T19:16:44Z"},{"id":1207,"body":"I know, right?","author":{"id":1,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"created_at":"2012-11-27T19:58:21Z"}]
+0
-23
spec/fixtures/pipeline.json less more
0 {
1 "id": 46,
2 "status": "success",
3 "ref": "master",
4 "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
5 "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
6 "tag": false,
7 "yaml_errors": null,
8 "user": {
9 "name": "Administrator",
10 "username": "root",
11 "id": 1,
12 "state": "active",
13 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
14 "web_url": "http://localhost:3000/root"
15 },
16 "created_at": "2016-08-11T11:28:34.085Z",
17 "updated_at": "2016-08-11T11:32:35.169Z",
18 "started_at": null,
19 "finished_at": "2016-08-11T11:32:35.145Z",
20 "committed_at": null,
21 "duration": null
22 }
+0
-23
spec/fixtures/pipeline_cancel.json less more
0 {
1 "id": 46,
2 "status": "canceled",
3 "ref": "master",
4 "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
5 "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
6 "tag": false,
7 "yaml_errors": null,
8 "user": {
9 "name": "Administrator",
10 "username": "root",
11 "id": 1,
12 "state": "active",
13 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
14 "web_url": "http://localhost:3000/root"
15 },
16 "created_at": "2016-08-11T11:28:34.085Z",
17 "updated_at": "2016-08-11T11:32:35.169Z",
18 "started_at": null,
19 "finished_at": "2016-08-11T11:32:35.145Z",
20 "committed_at": null,
21 "duration": null
22 }
+0
-23
spec/fixtures/pipeline_create.json less more
0 {
1 "id": 61,
2 "sha": "384c444e840a515b23f21915ee5766b87068a70d",
3 "ref": "master",
4 "status": "pending",
5 "before_sha": "0000000000000000000000000000000000000000",
6 "tag": false,
7 "yaml_errors": null,
8 "user": {
9 "name": "Administrator",
10 "username": "root",
11 "id": 1,
12 "state": "active",
13 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
14 "web_url": "http://localhost:3000/root"
15 },
16 "created_at": "2016-11-04T09:36:13.747Z",
17 "updated_at": "2016-11-04T09:36:13.977Z",
18 "started_at": null,
19 "finished_at": null,
20 "committed_at": null,
21 "duration": null
22 }
+0
-91
spec/fixtures/pipeline_jobs.json less more
0 [
1 {
2 "commit": {
3 "author_email": "admin@example.com",
4 "author_name": "Administrator",
5 "created_at": "2015-12-24T16:51:14.000+01:00",
6 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
7 "message": "Test the CI integration.",
8 "short_id": "0ff3ae19",
9 "title": "Test the CI integration."
10 },
11 "coverage": null,
12 "created_at": "2015-12-24T15:51:21.802Z",
13 "artifacts_file": {
14 "filename": "artifacts.zip",
15 "size": 1000
16 },
17 "finished_at": "2015-12-24T17:54:27.895Z",
18 "id": 7,
19 "name": "teaspoon",
20 "pipeline": {
21 "id": 6,
22 "ref": "master",
23 "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
24 "status": "pending"
25 },
26 "ref": "master",
27 "runner": null,
28 "stage": "test",
29 "started_at": "2015-12-24T17:54:27.722Z",
30 "status": "failed",
31 "tag": false,
32 "user": {
33 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
34 "bio": null,
35 "created_at": "2015-12-21T13:14:24.077Z",
36 "id": 1,
37 "linkedin": "",
38 "name": "Administrator",
39 "skype": "",
40 "state": "active",
41 "twitter": "",
42 "username": "root",
43 "web_url": "http://gitlab.dev/root",
44 "website_url": ""
45 }
46 },
47 {
48 "commit": {
49 "author_email": "admin@example.com",
50 "author_name": "Administrator",
51 "created_at": "2015-12-24T16:51:14.000+01:00",
52 "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
53 "message": "Test the CI integration.",
54 "short_id": "0ff3ae19",
55 "title": "Test the CI integration."
56 },
57 "coverage": null,
58 "created_at": "2015-12-24T15:51:21.727Z",
59 "artifacts_file": null,
60 "finished_at": "2015-12-24T17:54:24.921Z",
61 "id": 6,
62 "name": "spinach:other",
63 "pipeline": {
64 "id": 6,
65 "ref": "master",
66 "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
67 "status": "pending"
68 },
69 "ref": "master",
70 "runner": null,
71 "stage": "test",
72 "started_at": "2015-12-24T17:54:24.729Z",
73 "status": "failed",
74 "tag": false,
75 "user": {
76 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
77 "bio": null,
78 "created_at": "2015-12-21T13:14:24.077Z",
79 "id": 1,
80 "linkedin": "",
81 "name": "Administrator",
82 "skype": "",
83 "state": "active",
84 "twitter": "",
85 "username": "root",
86 "web_url": "http://gitlab.dev/root",
87 "website_url": ""
88 }
89 }
90 ]
+0
-23
spec/fixtures/pipeline_retry.json less more
0 {
1 "id": 46,
2 "status": "pending",
3 "ref": "master",
4 "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
5 "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
6 "tag": false,
7 "yaml_errors": null,
8 "user": {
9 "name": "Administrator",
10 "username": "root",
11 "id": 1,
12 "state": "active",
13 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
14 "web_url": "http://localhost:3000/root"
15 },
16 "created_at": "2016-08-11T11:28:34.085Z",
17 "updated_at": "2016-08-11T11:32:35.169Z",
18 "started_at": null,
19 "finished_at": "2016-08-11T11:32:35.145Z",
20 "committed_at": null,
21 "duration": null
22 }
+0
-48
spec/fixtures/pipelines.json less more
0 [
1 {
2 "id": 47,
3 "status": "pending",
4 "ref": "new-pipeline",
5 "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
6 "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
7 "tag": false,
8 "yaml_errors": null,
9 "user": {
10 "name": "Administrator",
11 "username": "root",
12 "id": 1,
13 "state": "active",
14 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
15 "web_url": "http://localhost:3000/root"
16 },
17 "created_at": "2016-08-16T10:23:19.007Z",
18 "updated_at": "2016-08-16T10:23:19.216Z",
19 "started_at": null,
20 "finished_at": null,
21 "committed_at": null,
22 "duration": null
23 },
24 {
25 "id": 48,
26 "status": "pending",
27 "ref": "new-pipeline",
28 "sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a",
29 "before_sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a",
30 "tag": false,
31 "yaml_errors": null,
32 "user": {
33 "name": "Administrator",
34 "username": "root",
35 "id": 1,
36 "state": "active",
37 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
38 "web_url": "http://localhost:3000/root"
39 },
40 "created_at": "2016-08-16T10:23:21.184Z",
41 "updated_at": "2016-08-16T10:23:21.314Z",
42 "started_at": null,
43 "finished_at": null,
44 "committed_at": null,
45 "duration": null
46 }
47 ]
+0
-1
spec/fixtures/project.json less more
0 {"id":3,"code":"gitlab","name":"Gitlab","description":null,"path":"gitlab","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"public":false,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:58Z"}
+0
-13
spec/fixtures/project_commit.json less more
0 {
1 "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
2 "short_id": "6104942438c",
3 "title": "Sanitize for network graph",
4 "author_name": "randx",
5 "author_email": "dmitriy.zaporozhets@gmail.com",
6 "created_at": "2012-09-20T09:06:12+03:00",
7 "committed_date": "2012-09-20T09:06:12+03:00",
8 "authored_date": "2012-09-20T09:06:12+03:00",
9 "parent_ids": [
10 "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
11 ]
12 }
+0
-1
spec/fixtures/project_commit_comment.json less more
0 {"note":"Nice code!","author":{"id":1,"username":"jsmith","email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-07-11T01:32:18Z"}}
+0
-1
spec/fixtures/project_commit_comments.json less more
0 [{"note":"this is the 1st comment on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6","author":{"id":11,"username":"admin","email":"admin@example.com","name":"A User","state":"active","created_at":"2014-03-06T08:17:35.000Z"}},{"note":"another discussion point on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6","author":{"id":12,"username":"admin","email":"admin@example.com","name":"A User","state":"active","created_at":"2014-03-06T08:17:35.000Z"}}]
+0
-22
spec/fixtures/project_commit_create.json less more
0 {
1 "id": "ed899a2f4b50b4370feeea94676502b42383c746",
2 "short_id": "ed899a2f4b5",
3 "title": "some commit message",
4 "author_name": "Dmitriy Zaporozhets",
5 "author_email": "dzaporozhets@sphereconsultinginc.com",
6 "committer_name": "Dmitriy Zaporozhets",
7 "committer_email": "dzaporozhets@sphereconsultinginc.com",
8 "created_at": "2016-09-20T09:26:24.000-07:00",
9 "message": "some commit message",
10 "parent_ids": [
11 "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
12 ],
13 "committed_date": "2016-09-20T09:26:24.000-07:00",
14 "authored_date": "2016-09-20T09:26:24.000-07:00",
15 "stats": {
16 "additions": 2,
17 "deletions": 2,
18 "total": 4
19 },
20 "status": null
21 }
+0
-10
spec/fixtures/project_commit_diff.json less more
0 {
1 "diff": "--- a/doc/update/5.4-to-6.0.md\n+++ b/doc/update/5.4-to-6.0.md\n@@ -71,6 +71,8 @@\n sudo -u git -H bundle exec rake migrate_keys RAILS_ENV=production\n sudo -u git -H bundle exec rake migrate_inline_notes RAILS_ENV=production\n \n+sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production\n+\n ```\n \n ### 6. Update config files",
2 "new_path": "doc/update/5.4-to-6.0.md",
3 "old_path": "doc/update/5.4-to-6.0.md",
4 "a_mode": null,
5 "b_mode": "100644",
6 "new_file": false,
7 "renamed_file": false,
8 "deleted_file": false
9 }
+0
-42
spec/fixtures/project_commit_status.json less more
0 [
1 {
2 "id": 496,
3 "sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8",
4 "ref": "decreased-spec",
5 "status": "failed",
6 "name": "test",
7 "target_url": null,
8 "description": null,
9 "created_at": "2015-10-23T23:35:48.693+02:00",
10 "started_at": null,
11 "finished_at": "2015-10-23T23:35:48.716+02:00",
12 "author": {
13 "name": "Dominik Sander",
14 "username": "dsander",
15 "id": 1,
16 "state": "active",
17 "avatar_url": "https://secure.gravatar.com/avatar/xxxxx?s=40&d=identicon",
18 "web_url": "https://github.com/u/dsander"
19 }
20 },
21 {
22 "id": 493,
23 "sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8",
24 "ref": "decreased-spec",
25 "status": "success",
26 "name": "specs",
27 "target_url": "https://github.com/dsander/omniauth/builds/493",
28 "description": null,
29 "created_at": "2015-10-23T21:39:19.384+02:00",
30 "started_at": "2015-10-23T21:39:21.900+02:00",
31 "finished_at": "2015-10-23T21:39:35.215+02:00",
32 "author": {
33 "name": "Dominik Sander",
34 "username": "dsander",
35 "id": 1,
36 "state": "active",
37 "avatar_url": "https://secure.gravatar.com/avatar/xxxxx?s=40&d=identicon",
38 "web_url": "https://github.com/u/dsander"
39 }
40 }
41 ]
+0
-1
spec/fixtures/project_commits.json less more
0 [{"id":"f7dd067490fe57505f7226c3b54d3127d2f7fd46","short_id":"f7dd067490f","title":"API: expose issues project id","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-25T04:22:21-07:00"},{"id":"949b1df930bedace1dbd755aaa4a82e8c451a616","short_id":"949b1df930b","title":"API: update docs","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-25T02:35:41-07:00"},{"id":"1b95c8bff351f6718ec31ac1de1e48c57bc95d44","short_id":"1b95c8bff35","title":"API: ability to get project by id","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-25T02:18:30-07:00"},{"id":"92d98f5a0c28bffd7b070cda190b07ab72667d58","short_id":"92d98f5a0c2","title":"Merge pull request #1118 from patthoyts/pt/ldap-missing-password","author_name":"Dmitriy Zaporozhets","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-25T01:51:06-07:00"},{"id":"60d3e94874964a626f105d3598e1c122addcf43e","short_id":"60d3e948749","title":"Merge pull request #1122 from patthoyts/pt/missing-log","author_name":"Dmitriy Zaporozhets","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-25T01:50:34-07:00"},{"id":"b683a71aa1230f17f9df47661c77dfeae27027de","short_id":"b683a71aa12","title":"Merge pull request #1135 from NARKOZ/api","author_name":"Dmitriy Zaporozhets","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-25T01:48:00-07:00"},{"id":"fbb41100db35cf2def2c8b4d896b7015d56bd15b","short_id":"fbb41100db3","title":"update help section with issues API docs","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-24T05:52:43-07:00"},{"id":"eca823c1c7cef45cc18c6ab36d2327650c85bfc3","short_id":"eca823c1c7c","title":"Merge branch 'master' into api","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-24T05:46:36-07:00"},{"id":"024e0348904179a8dea81c01e27a5f014cf57499","short_id":"024e0348904","title":"update API docs","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-24T05:25:01-07:00"},{"id":"7b33d8cbcab3b0ee5789ec607455ab62130db69f","short_id":"7b33d8cbcab","title":"add issues API","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-24T05:19:51-07:00"},{"id":"6035ad7e1fe519d0c6a42731790183889e3ba31d","short_id":"6035ad7e1fe","title":"Create the githost.log file if necessary.","author_name":"Pat Thoyts","author_email":"patthoyts@users.sourceforge.net","created_at":"2012-07-21T07:32:04-07:00"},{"id":"a2d244ec062f3348f6cd1c5218c6097402c5f562","short_id":"a2d244ec062","title":"Handle LDAP missing credentials error with a flash message.","author_name":"Pat Thoyts","author_email":"patthoyts@users.sourceforge.net","created_at":"2012-07-21T01:04:05-07:00"},{"id":"8b7e404b5b6944e9c92cc270b2e5d0005781d49d","short_id":"8b7e404b5b6","title":"Up to 2.7.0","author_name":"randx","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-21T00:53:55-07:00"},{"id":"11721b0dbe82c35789be3e4fa8e14663934b2ff5","short_id":"11721b0dbe8","title":"Help section for system hooks completed","author_name":"randx","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-21T00:47:57-07:00"},{"id":"9c8a1e651716212cf50a623d98e03b8dbdb2c64a","short_id":"9c8a1e65171","title":"Fix system hook example","author_name":"randx","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-21T00:32:42-07:00"},{"id":"4261acda90ff4c61326d80cba026ae76e8551f8f","short_id":"4261acda90f","title":"move SSH keys tab closer to begining","author_name":"randx","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-21T00:27:09-07:00"},{"id":"a69fc5dd23bd502fd36892a80eec21a4c53891f8","short_id":"a69fc5dd23b","title":"Endless event loading for dsahboard","author_name":"randx","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-21T00:23:05-07:00"},{"id":"860fa1163a5fbdfec2bb01ff2d584351554dee29","short_id":"860fa1163a5","title":"Merge pull request #1117 from patthoyts/pt/user-form","author_name":"Dmitriy Zaporozhets","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-20T14:23:49-07:00"},{"id":"787e5e94acf5e20280416c9fda105ef5b77576b3","short_id":"787e5e94acf","title":"Fix english on the edit user form.","author_name":"Pat Thoyts","author_email":"patthoyts@users.sourceforge.net","created_at":"2012-07-20T14:18:42-07:00"},{"id":"9267cb04b0b3fdf127899c4b7e636dc27fac06d3","short_id":"9267cb04b0b","title":"Merge branch 'refactoring_controllers' of dev.gitlabhq.com:gitlabhq","author_name":"Dmitriy Zaporozhets","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-20T07:24:56-07:00"}]
+0
-21
spec/fixtures/project_edit.json less more
0 {
1 "id":3,
2 "code":"gitlab",
3 "name":"Gitlab-edit",
4 "description":null,
5 "path":"gitlab",
6 "default_branch":null,
7 "owner":{
8 "id":1,
9 "email":"john@example.com",
10 "name":"John Smith",
11 "blocked":false,
12 "created_at":"2012-09-17T09:41:56Z"
13 },
14 "public":false,
15 "issues_enabled":true,
16 "merge_requests_enabled":true,
17 "wall_enabled":true,
18 "wiki_enabled":true,
19 "created_at":"2012-09-17T09:41:58Z"
20 }
+0
-1
spec/fixtures/project_events.json less more
0 [{"title":null,"project_id":2,"action_name":"opened","target_id":null,"target_type":null,"author_id":1,"data":{"before":"ac0c1aa3898d6dea54d7868ea6f9c45fd5e30c59","after":"66350dbb62a221bc619b665aef3e1e7d3b306747","ref":"refs/heads/master","user_id":1,"user_name":"Administrator","project_id":2,"repository":{"name":"gitlab-ci","url":"git@demo.gitlab.com:gitlab/gitlab-ci.git","description":"Continuous integration server for gitlabhq | Coordinator","homepage":"http://demo.gitlab.com/gitlab/gitlab-ci"},"commits":[{"id":"8cf469b039931bab37bbf025e6b69287ea3cfb0e","message":"Modify screenshot\n\nSigned-off-by: Dmitriy Zaporozhets \u003Cdummy@gmail.com\u003E","timestamp":"2014-05-20T10:34:27+00:00","url":"http://demo.gitlab.com/gitlab/gitlab-ci/commit/8cf469b039931bab37bbf025e6b69287ea3cfb0e","author":{"name":"Dummy","email":"dummy@gmail.com"}},{"id":"66350dbb62a221bc619b665aef3e1e7d3b306747","message":"Edit some code\n\nSigned-off-by: Dmitriy Zaporozhets \u003Cdummy@gmail.com\u003E","timestamp":"2014-05-20T10:35:15+00:00","url":"http://demo.gitlab.com/gitlab/gitlab-ci/commit/66350dbb62a221bc619b665aef3e1e7d3b306747","author":{"name":"Dummy","email":"dummy@gmail.com"}}],"total_commits_count":2},"target_title":null,"created_at":"2014-05-20T10:35:26.240Z"},{"title":null,"project_id":2,"action_name":"opened","target_id":2,"target_type":"MergeRequest","author_id":1,"data":null,"target_title":" Morbi et cursus leo. Sed eget vestibulum sapien","created_at":"2014-05-20T10:24:11.917Z"}]
+0
-1
spec/fixtures/project_for_user.json less more
0 {"id":1,"code":"brute","name":"Brute","description":null,"path":"brute","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Owner","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"private":true,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:56Z"}
+0
-50
spec/fixtures/project_fork.json less more
0 {
1 "id":20,
2 "description":"desc",
3 "default_branch":"master",
4 "tag_list":[
5
6 ],
7 "public":false,
8 "archived":false,
9 "visibility_level":10,
10 "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git",
11 "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git",
12 "web_url":"http://git.gitlab.com/root/gitlab",
13 "owner":{
14 "name":"Administrator",
15 "username":"root",
16 "id":1,
17 "state":"active",
18 "avatar_url":"http://git.gitlab.com/uploads/user/avatar/1/12586377.jpeg"
19 },
20 "name":"gitlab",
21 "name_with_namespace":"Administrator / gitlab",
22 "path":"gitlab",
23 "path_with_namespace":"root/gitlab",
24 "issues_enabled":true,
25 "merge_requests_enabled":true,
26 "wiki_enabled":true,
27 "snippets_enabled":false,
28 "created_at":"2015-06-08T01:29:17.190Z",
29 "last_activity_at":"2015-06-08T01:29:17.190Z",
30 "creator_id":1,
31 "namespace":{
32 "id":1,
33 "name":"root",
34 "path":"root",
35 "owner_id":1,
36 "created_at":"2015-05-28T19:23:40.445Z",
37 "updated_at":"2015-05-28T19:23:40.445Z",
38 "description":"",
39 "avatar":null
40 },
41 "forked_from_project":{
42 "id":3,
43 "name":"Gitlab",
44 "name_with_namespace":"Root / gitlab",
45 "path":"gitlab",
46 "path_with_namespace":"root/gitlab"
47 },
48 "avatar_url":null
49 }
+0
-1
spec/fixtures/project_fork_link.json less more
0 {"created_at":"2013-07-03T13:51:48Z","forked_from_project_id":24,"forked_to_project_id":42,"id":1,"updated_at":"2013-07-03T13:51:48Z"}
+0
-50
spec/fixtures/project_forked_for_user.json less more
0 {
1 "id":20,
2 "description":"desc",
3 "default_branch":"master",
4 "tag_list":[
5
6 ],
7 "public":false,
8 "archived":false,
9 "visibility_level":10,
10 "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git",
11 "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git",
12 "web_url":"http://git.gitlab.com/root/gitlab",
13 "owner":{
14 "name":"Jack Smith",
15 "username":"jack.smith",
16 "id":2,
17 "state":"active",
18 "avatar_url":"http://git.gitlab.com/uploads/user/avatar/1/12586377.jpeg"
19 },
20 "name":"gitlab",
21 "name_with_namespace":"Jack Smith / gitlab",
22 "path":"gitlab",
23 "path_with_namespace":"jack.smith/gitlab",
24 "issues_enabled":true,
25 "merge_requests_enabled":true,
26 "wiki_enabled":true,
27 "snippets_enabled":false,
28 "created_at":"2015-06-08T01:29:17.190Z",
29 "last_activity_at":"2015-06-08T01:29:17.190Z",
30 "creator_id":1,
31 "namespace":{
32 "id":1,
33 "name":"jack.smith",
34 "path":"jack.smith",
35 "owner_id":2,
36 "created_at":"2015-05-28T19:23:40.445Z",
37 "updated_at":"2015-05-28T19:23:40.445Z",
38 "description":"",
39 "avatar":null
40 },
41 "forked_from_project":{
42 "id":3,
43 "name":"Gitlab",
44 "name_with_namespace":"Root / gitlab",
45 "path":"gitlab",
46 "path_with_namespace":"root/gitlab"
47 },
48 "avatar_url":null
49 }
+0
-1
spec/fixtures/project_hook.json less more
0 {"id":1,"url":"https://api.example.net/v1/webhooks/ci"}
+0
-1
spec/fixtures/project_hooks.json less more
0 [{"id":1,"url":"https://api.example.net/v1/webhooks/ci"}]
+0
-1
spec/fixtures/project_issues.json less more
0 [{"id":36,"project_id":3,"title":"Eos ut modi et laudantium quasi porro voluptas sed.","description":null,"labels":[],"milestone":null,"assignee":{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":35,"project_id":3,"title":"Ducimus illo in iure voluptatem dolores labore.","description":null,"labels":[],"milestone":null,"assignee":{"id":4,"email":"nicole@mertz.com","name":"Felipe Davis","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":4,"email":"nicole@mertz.com","name":"Felipe Davis","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":34,"project_id":3,"title":"Rem tempora voluptatum atque eum sit nihil neque.","description":null,"labels":[],"milestone":null,"assignee":{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":33,"project_id":3,"title":"Beatae possimus nostrum nihil reiciendis laboriosam nihil delectus alias accusantium dolor unde.","description":null,"labels":[],"milestone":null,"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":32,"project_id":3,"title":"Deserunt tenetur impedit est beatae voluptas voluptas quaerat quisquam.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":16,"project_id":3,"title":"Numquam earum aut laudantium reprehenderit voluptatem aut.","description":null,"labels":[],"milestone":null,"assignee":{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":15,"project_id":3,"title":"Qui veritatis voluptas fuga voluptate voluptas cupiditate.","description":null,"labels":[],"milestone":null,"assignee":{"id":4,"email":"nicole@mertz.com","name":"Felipe Davis","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":4,"email":"nicole@mertz.com","name":"Felipe Davis","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":14,"project_id":3,"title":"In assumenda et ipsa qui debitis voluptatem incidunt.","description":null,"labels":[],"milestone":null,"assignee":{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":13,"project_id":3,"title":"Illo eveniet consequatur enim iste provident facilis rerum voluptatem et architecto aut.","description":null,"labels":[],"milestone":null,"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":12,"project_id":3,"title":"Veniam et tempore quidem eum reprehenderit cupiditate non aut velit eaque.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}]
+0
-6
spec/fixtures/project_key.json less more
0 {
1 "id": 2,
2 "title": "Key Title",
3 "key": "ssh-rsa ...",
4 "created_at": "2013-09-22T18:34:32Z"
5 }
+0
-6
spec/fixtures/project_keys.json less more
0 [{
1 "id": 2,
2 "title": "Key Title",
3 "key": "ssh-rsa ...",
4 "created_at": "2013-09-22T18:34:32Z"
5 }]
+0
-7
spec/fixtures/project_runner_enable.json less more
0 {
1 "active": true,
2 "description": "test-2016-02-01",
3 "id": 9,
4 "is_shared": false,
5 "name": null
6 }
+0
-16
spec/fixtures/project_runners.json less more
0 [
1 {
2 "active": true,
3 "description": "test-2-20150125",
4 "id": 8,
5 "is_shared": false,
6 "name": null
7 },
8 {
9 "active": true,
10 "description": "development_runner",
11 "id": 5,
12 "is_shared": true,
13 "name": null
14 }
15 ]
+0
-1
spec/fixtures/project_search.json less more
0 [{"id":3,"code":"gitlab","name":"Gitlab","description":null,"path":"gitlab","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"private":true,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:58Z"}]
+0
-44
spec/fixtures/project_star.json less more
0 {
1 "id": 3,
2 "description": null,
3 "default_branch": "master",
4 "public": false,
5 "visibility_level": 10,
6 "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git",
7 "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git",
8 "web_url":"http://git.gitlab.com/root/gitlab",
9 "tag_list": [
10
11 ],
12 "name": "GitLab Community Edition",
13 "name_with_namespace": "GitLab / GitLab Community Edition",
14 "path": "gitlab-ce",
15 "path_with_namespace": "gitlab/gitlab-ce",
16 "issues_enabled": true,
17 "open_issues_count": 1,
18 "merge_requests_enabled": true,
19 "builds_enabled": true,
20 "wiki_enabled": true,
21 "snippets_enabled": false,
22 "container_registry_enabled": false,
23 "created_at": "2013-09-30T13:46:02Z",
24 "last_activity_at": "2013-09-30T13:46:02Z",
25 "creator_id": 3,
26 "namespace": {
27 "created_at": "2013-09-30T13:46:02Z",
28 "description": "",
29 "id": 3,
30 "name": "GitLab",
31 "owner_id": 1,
32 "path": "gitlab",
33 "updated_at": "2013-09-30T13:46:02Z"
34 },
35 "archived": true,
36 "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
37 "shared_runners_enabled": true,
38 "forks_count": 0,
39 "star_count": 1,
40 "public_builds": true,
41 "shared_with_groups": [],
42 "only_allow_merge_if_build_succeeds": false
43 }
+0
-1
spec/fixtures/project_tag_annotated.json less more
0 {"name": "v1.1.0","message": "Release 1.1.0","commit": {"id": "2695effb5807a22ff3d138d593fd856244e155e7","parents": [],"message": "Initial commit","authored_date": "2012-05-28T04:42:42-07:00","author_name": "John Smith","author email": "john@example.com","committer_name": "Jack Smith","committed_date": "2012-05-28T04:42:42-07:00","committer_email": "jack@example.com"}}
+0
-1
spec/fixtures/project_tag_lightweight.json less more
0 {"name": "v1.0.0","message": null,"commit": {"id": "2695effb5807a22ff3d138d593fd856244e155e7","parents": [],"message": "Initial commit","authored_date": "2012-05-28T04:42:42-07:00","author_name": "John Smith","author email": "john@example.com","committer_name": "Jack Smith","committed_date": "2012-05-28T04:42:42-07:00","committer_email": "jack@example.com"}}
+0
-1
spec/fixtures/project_tags.json less more
0 [{"name":"v2.8.2","commit":{"id":"a502f67c0b358cc6b391df0c5dca48375c21fcad","parents":[{"id":"4381084af341684240b1a671d368511afcf5774a"}],"tree":"1612068bdd20de5d14b3096cfa4c621e2051ed4c","message":"Up to 2.8.2","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-08-24T02:03:48-07:00","committed_date":"2012-08-24T02:03:48-07:00"}},{"name":"v2.8.1","commit":{"id":"ed2b53cd1c34c421b23208eeb502a141a6829f9d","parents":[{"id":"7ab587a47791e371f5c109c14097a5d1d7776ea5"}],"tree":"b7393b0b33b777583b285e85b423c4e5ab7f859f","message":"Up to 2.8.1","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-08-22T23:17:18-07:00","committed_date":"2012-08-22T23:17:18-07:00"}},{"name":"v2.8.0pre","commit":{"id":"b2c6ba97a25d299e83c51493d7bc770c13b8ed1a","parents":[{"id":"05da3801f53f06fdc529b4f3820af1380039f245"},{"id":"66399d558da45fb9cd3ea972a47a4f7bb12bfc8d"}],"tree":"36ad53f35bce1fe3f2a4a5f840e7b1bdbfed9c82","message":"Merge pull request #1230 from tsigo/hooray_apostrophes\n\nCorrect usage of \"Can't\"","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-08-16T14:11:08-07:00","committed_date":"2012-08-16T14:11:08-07:00"}},{"name":"v2.8.0","commit":{"id":"5c7ed6fa26b47ac71ff6ba04720d85df6d74b200","parents":[{"id":"d1daeba1736ba145fe525ce08a91f29495a3abf1"}],"tree":"4fc230ff2dbc0e75f27321eac2976aba5a6d323d","message":"Up to 2.8","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-08-21T15:15:26-07:00","committed_date":"2012-08-21T15:15:26-07:00"}},{"name":"v2.7.0pre","commit":{"id":"72a571724d84d112f98a5543c971e9b3b9da1383","parents":[{"id":"3ac840ff06e0ee5b349c52b5a8c02e803a17eec3"},{"id":"990b9217d9a55e26a53d4143d4a3c89123384327"}],"tree":"64b104df5d956e21e0749dc8e70849d1989de36f","message":"Merge pull request #1096 from moregeek/show-flash-note-when-destroying-a-project\n\nshow flash notice after deletion of a project","author":{"name":"Valeriy Sizov","email":"vsv2711@gmail.com"},"committer":{"name":"Valeriy Sizov","email":"vsv2711@gmail.com"},"authored_date":"2012-07-18T05:35:42-07:00","committed_date":"2012-07-18T05:35:42-07:00"}},{"name":"v2.7.0","commit":{"id":"8b7e404b5b6944e9c92cc270b2e5d0005781d49d","parents":[{"id":"11721b0dbe82c35789be3e4fa8e14663934b2ff5"}],"tree":"89fe8c5ff58daaedea07a910cffb14b04ebcc828","message":"Up to 2.7.0","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-07-21T00:53:55-07:00","committed_date":"2012-07-21T00:53:55-07:00"}},{"name":"v2.6.3","commit":{"id":"666cdb22792dd955a286b9993d6235b4cdd68b4b","parents":[{"id":"d92446df1fdba87101c92c90b1c34eb2f1eebef4"}],"tree":"888173aa4c12a4920d318c35b950095d3505673d","message":"up to 2.6.3","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-06-26T09:20:47-07:00","committed_date":"2012-06-26T09:21:28-07:00"}},{"name":"v2.6.2","commit":{"id":"39fecb554f172a0c8ea00316e612e1d37efc7200","parents":[{"id":"68389588d664100590b1a6ca7eedd50860b7e9bc"}],"tree":"53accb25e0b9d038d550cf387753bde15fe4ad19","message":"Up to 2.6.2","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-06-22T13:50:58-07:00","committed_date":"2012-06-22T13:50:58-07:00"}},{"name":"v2.6.1","commit":{"id":"d92a22c9e627268eca697bbd9b660d8c335df953","parents":[{"id":"193804516b8b0783c850981456e947f888ff51bb"}],"tree":"4ac1b5225f597ab55372cb5e950b121d6f55e386","message":"Up to 2.6.1","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-06-22T12:49:03-07:00","committed_date":"2012-06-22T12:49:03-07:00"}},{"name":"v2.6.0","commit":{"id":"b32465712becfbcf83d63b1e6eff7d1483fdabea","parents":[{"id":"1903f6ade027df0f10ef96b9439495eeda07482c"}],"tree":"ffbc05fd0f1771c1602c956df9556260048c7167","message":"Up to 2.6","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-06-21T10:25:23-07:00","committed_date":"2012-06-21T10:25:23-07:00"}},{"name":"v2.5.0","commit":{"id":"cc8369144db2147d2956e8dd7d314e9a7dfd4fbb","parents":[{"id":"1b2068eaa91e5002d01a220c65da21dad8ccb071"}],"tree":"666a442e00689911169e8cc336c5ce60d014854c","message":"Prevent app crash in case if encoding failed","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-05-22T04:57:04-07:00","committed_date":"2012-05-22T04:57:04-07:00"}},{"name":"v2.4.2","commit":{"id":"f18339c26d673c5f8b4c19776036fd42a0de30aa","parents":[{"id":"c937d06c3c98e9ffce8ec1132203eaff6bf7b231"},{"id":"35e602f19c83585d64aa2043ed26eeb8cd7b40e2"}],"tree":"5101f0cd8e395fee1996764298a202437757e85b","message":"Merge branch 'master' of github.com:gitlabhq/gitlabhq","author":{"name":"Zevs","email":"vsv2711@gmail.com"},"committer":{"name":"Zevs","email":"vsv2711@gmail.com"},"authored_date":"2012-04-29T14:24:59-07:00","committed_date":"2012-04-29T14:24:59-07:00"}},{"name":"v2.4.1","commit":{"id":"d97a9aa4a44ff9f452144fad348fd9d7e3b48260","parents":[{"id":"21f3da23589d50038728393f0badc6255b5762ca"}],"tree":"905c33874b064778199f806749d5688e33d64be3","message":"fixed email markdown","author":{"name":"gitlabhq","email":"m@gitlabhq.com"},"committer":{"name":"gitlabhq","email":"m@gitlabhq.com"},"authored_date":"2012-04-23T05:32:56-07:00","committed_date":"2012-04-23T05:32:56-07:00"}},{"name":"v2.4.0pre","commit":{"id":"1845429268364e75bffdeb1075de8f1606e157ec","parents":[{"id":"45b18365d5f409f196a02a4e6e2b77b8ebef909b"}],"tree":"423c70246fa7ffd8804b26628fea34bdb2b22846","message":"Use try for commit prev_commit_id detection","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-04-19T13:35:35-07:00","committed_date":"2012-04-19T13:35:35-07:00"}},{"name":"v2.4.0","commit":{"id":"204c66461ed519eb0078be7e8ac8a6cb56834753","parents":[{"id":"511d07c47c9bf3a18bfa276d452c899369432a22"}],"tree":"9416c777cccf87d348f5705078e82f3f97485e19","message":"corrected exception for automerge","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-04-22T06:49:45-07:00","committed_date":"2012-04-22T06:49:45-07:00"}},{"name":"v2.3.1","commit":{"id":"fa8219e0a753e642a6f1dbdfc010d01ae8a949ee","parents":[{"id":"81da8e46f24913ccf42d3e2644962cbcbc0f9c2e"}],"tree":"5debfcd6d17f9d582aace6ac9b80db27d5c1fe36","message":"better MR list, dashboard pollished","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-03-22T13:57:04-07:00","committed_date":"2012-03-22T13:57:04-07:00"}},{"name":"v2.3.0pre","commit":{"id":"cadf12c60cc27c5b0b8273c1de4b190a0e88bd7d","parents":[{"id":"724ea16c348bc61cf7cb3dbe362c6f30cff1b2c7"}],"tree":"6f4c22761fd2dee405d3fbf38f9dd835bb3c8694","message":"Merged activities & projects pages","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-03-19T15:05:35-07:00","committed_date":"2012-03-19T15:05:35-07:00"}},{"name":"v2.3.0","commit":{"id":"b57faf9282d7df6cdd62953d474652a0ae2e6896","parents":[{"id":"cadf12c60cc27c5b0b8273c1de4b190a0e88bd7d"}],"tree":"f0d5b826df373191b4681452fc2ae4c5970cef4a","message":"Push events polished","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-03-20T14:59:35-07:00","committed_date":"2012-03-20T14:59:35-07:00"}},{"name":"v2.2.0pre","commit":{"id":"6a445b42003007cbb6c06f477c4d7a0b175688c1","parents":[{"id":"22f4c1908d0fc2dbce02e74ed03bf65f028d78d6"}],"tree":"9c60577833f6ca717acdebfa66140124c88e8471","message":"fixed forgot password form","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-02-20T10:37:37-08:00","committed_date":"2012-02-20T10:37:37-08:00"}},{"name":"v2.2.0","commit":{"id":"9e6d0710e927aa8ea834b8a9ae9f277be617ac7d","parents":[{"id":"8c40aab120dbc5507ab9cc8d7ad8e2519d6e9f25"},{"id":"6ea87c47f0f8a24ae031c3fff17bc913889ecd00"}],"tree":"86c831ab21236f21ffa5b97c752369612ce41b39","message":"Merge pull request #443 from CedricGatay/fix/incorrectLineNumberingInDiff\n\nIncorrect line numbering in diff","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-02-22T07:14:54-08:00","committed_date":"2012-02-22T07:14:54-08:00"}},{"name":"v2.1.0","commit":{"id":"98d6492582d232ed86525aa31ccbf280f4cbdaef","parents":[{"id":"611c5a87ab0c083a43785323b09cc47f554c3ba4"}],"tree":"1689b3cad580a18fd9b429ee0b33dac21c9f5a48","message":"removed broken migration","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-01-22T10:52:06-08:00","committed_date":"2012-01-22T10:52:06-08:00"}},{"name":"v2.0.0","commit":{"id":"9a2a8612769d472503b367fa35e99f6fb2876704","parents":[{"id":"2f7b67161952fc9ab322eba6878511b5f2dd5cf1"}],"tree":"26cdb4e66b5e664fe4bcd57d011c54c9c9c26ded","message":"Design tab for profile. Colorscheme as db value","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2011-12-20T12:47:09-08:00","committed_date":"2011-12-20T12:47:09-08:00"}},{"name":"v1.2.2","commit":{"id":"139a332293b9d8c4e5436619036e093483d8347f","parents":[{"id":"ade12da9488bea19d12505c371ead35686a1436e"}],"tree":"365d57f4df5c5dcac69b666cf6d2bfd8ef058008","message":"updated readme","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-11-25T14:30:51-08:00","committed_date":"2011-11-25T14:30:51-08:00"}},{"name":"v1.2.1","commit":{"id":"7ebba27db21719c0035bab65fea92a4780051c73","parents":[{"id":"b56024100d40457a998f83adae3cdc830c997cda"},{"id":"a4fbe13fce87cb6ff2a27a2574ae25bf1dad145c"}],"tree":"b121a7576af1503a96954ce9a94598a68579e053","message":"Merge branch 'master' of dev.gitlabhq.com:gitlabhq","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-11-22T13:15:09-08:00","committed_date":"2011-11-22T13:15:09-08:00"}},{"name":"v1.2.0pre","commit":{"id":"86829cae50857b5edf74b935380c6f68a19c2282","parents":[{"id":"a6b99319381c2d62ec4b92d64805e8de8965859e"}],"tree":"6aab9d13000584fa96fb3cb34d94f3b122bd1143","message":"fixed min height for menu","author":{"name":"gitlabhq","email":"m@gitlabhq.com"},"committer":{"name":"gitlabhq","email":"m@gitlabhq.com"},"authored_date":"2011-11-22T06:03:27-08:00","committed_date":"2011-11-22T06:03:27-08:00"}},{"name":"v1.2.0","commit":{"id":"b56024100d40457a998f83adae3cdc830c997cda","parents":[{"id":"4451b8df8ad6d4b6d79fbce77687c6c2fd37d0a9"}],"tree":"f402cbb6d54526a32b30968c98410bae97b27c8d","message":"lil style fixes","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-11-22T09:57:25-08:00","committed_date":"2011-11-22T09:57:25-08:00"}},{"name":"v1.1.0pre","commit":{"id":"6b030fd41d697e327d2935b406cba70b6a460504","parents":[{"id":"3a2b273316fb29d63b489906f85d9b5329377258"}],"tree":"63b1fdb2a0f135f7074f6a94da14543b8450dd71","message":"1.1pre1","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-10-21T10:04:41-07:00","committed_date":"2011-10-21T10:04:41-07:00"}},{"name":"v1.1.0","commit":{"id":"ba8048d71019b5aaa1f92ee5c3415bfddaa9babb","parents":[{"id":"6b030fd41d697e327d2935b406cba70b6a460504"}],"tree":"4db2b5f4f9b374dd1be3579459bc5947c225c9ba","message":"v1.1.0","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-10-22T06:07:26-07:00","committed_date":"2011-10-22T06:07:26-07:00"}},{"name":"v1.0.2","commit":{"id":"3a2b273316fb29d63b489906f85d9b5329377258","parents":[{"id":"757ea634665e475bf69c1ec962040a0511ee8aeb"},{"id":"c374eb80ff9fb71d37faffc15714bf98b632d3e5"}],"tree":"e0d8170e61a9468a7bb5d4e63305171ec1efa6bf","message":"Merge pull request #40 from vslinko/patch-1\n\nIncrease max key length. Some keys has comment after key string.","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2011-10-18T23:30:06-07:00","committed_date":"2011-10-18T23:30:06-07:00"}},{"name":"v1.0.1","commit":{"id":"7b5799a97998b68416f1b6233ce427135c99165a","parents":[{"id":"0541b3f3c5dcd291d144c83d9731c75ee811b4e0"},{"id":"7b67480c76db8b9a9ccdc80015cc500dc6d26892"}],"tree":"e052185e9dd72a1b1a04d59a5f9efbf3c0369601","message":"Merge branch '1x' of github.com:gitlabhq/gitlabhq into 1x","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-10-14T15:16:44-07:00","committed_date":"2011-10-14T15:16:44-07:00"}}]
+0
-44
spec/fixtures/project_unstar.json less more
0 {
1 "id": 3,
2 "description": null,
3 "default_branch": "master",
4 "public": false,
5 "visibility_level": 10,
6 "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git",
7 "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git",
8 "web_url":"http://git.gitlab.com/root/gitlab",
9 "tag_list": [
10
11 ],
12 "name": "GitLab Community Edition",
13 "name_with_namespace": "GitLab / GitLab Community Edition",
14 "path": "gitlab-ce",
15 "path_with_namespace": "gitlab/gitlab-ce",
16 "issues_enabled": true,
17 "open_issues_count": 1,
18 "merge_requests_enabled": true,
19 "builds_enabled": true,
20 "wiki_enabled": true,
21 "snippets_enabled": false,
22 "container_registry_enabled": false,
23 "created_at": "2013-09-30T13:46:02Z",
24 "last_activity_at": "2013-09-30T13:46:02Z",
25 "creator_id": 3,
26 "namespace": {
27 "created_at": "2013-09-30T13:46:02Z",
28 "description": "",
29 "id": 3,
30 "name": "GitLab",
31 "owner_id": 1,
32 "path": "gitlab",
33 "updated_at": "2013-09-30T13:46:02Z"
34 },
35 "archived": true,
36 "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
37 "shared_runners_enabled": true,
38 "forks_count": 0,
39 "star_count": 0,
40 "public_builds": true,
41 "shared_with_groups": [],
42 "only_allow_merge_if_build_succeeds": false
43 }
+0
-20
spec/fixtures/project_update_commit_status.json less more
0 {
1 "id": 498,
2 "sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8",
3 "ref": "decreased-spec",
4 "status": "failed",
5 "name": "test",
6 "target_url": null,
7 "description": null,
8 "created_at": "2015-10-23T23:56:49.499+02:00",
9 "started_at": null,
10 "finished_at": "2015-10-23T23:56:49.534+02:00",
11 "author": {
12 "name": "Dominik Sander",
13 "username": "dsander",
14 "id": 1,
15 "state": "active",
16 "avatar_url": "https://secure.gravatar.com/avatar/xxx?s=40&d=identicon",
17 "web_url": "https://github.com/u/dsander"
18 }
19 }
+0
-1
spec/fixtures/projects.json less more
0 [{"id":1,"code":"brute","name":"Brute","description":null,"path":"brute","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"private":true,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:56Z"},{"id":2,"code":"mozart","name":"Mozart","description":null,"path":"mozart","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"private":true,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:57Z"},{"id":3,"code":"gitlab","name":"Gitlab","description":null,"path":"gitlab","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"private":true,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:58Z"}]
+0
-1
spec/fixtures/push_rule.json less more
0 {"id": 1, "project_id": 1, "created_at": "2016-05-25T20:27:15.545Z", "commit_message_regex": "\\b[A-Z]{3}-[0-9]+\\b", "deny_delete_tag": false}
+0
-2
spec/fixtures/raw_file.json less more
0 source 'https://rubygems.org'
1 gem 'rails', '4.1.2'
+0
-1
spec/fixtures/release_create.json less more
0 {"tag_name":"0.0.1","description":"Amazing release. Wow"}
+0
-1
spec/fixtures/release_update.json less more
0 {"tag_name":"0.0.1","description":"Amazing release. Wow"}
+0
-1
spec/fixtures/repository_file.json less more
0 {"file_path":"path","branch_name":"branch","encoding":"base64","content":"Y29udGVudA==","commit_message":"commit message"}
+0
-1
spec/fixtures/run_trigger.json less more
0 {"id":8,"variables":{"a":"10"}}
+0
-26
spec/fixtures/runner.json less more
0 {
1 "active": true,
2 "architecture": null,
3 "description": "test-1-20150125",
4 "id": 6,
5 "is_shared": false,
6 "contacted_at": "2016-01-25T16:39:48.066Z",
7 "name": null,
8 "platform": null,
9 "projects": [
10 {
11 "id": 1,
12 "name": "GitLab Community Edition",
13 "name_with_namespace": "GitLab.org / GitLab Community Edition",
14 "path": "gitlab-ce",
15 "path_with_namespace": "gitlab-org/gitlab-ce"
16 }
17 ],
18 "token": "205086a8e3b9a2b818ffac9b89d102",
19 "revision": null,
20 "tag_list": [
21 "ruby",
22 "mysql"
23 ],
24 "version": null
25 }
+0
-7
spec/fixtures/runner_delete.json less more
0 {
1 "active": true,
2 "description": "test-1-20150125-test",
3 "id": 6,
4 "is_shared": false,
5 "name": null
6 }
+0
-26
spec/fixtures/runner_edit.json less more
0 {
1 "active": true,
2 "architecture": null,
3 "description": "abcefg",
4 "id": 6,
5 "is_shared": false,
6 "contacted_at": "2016-01-25T16:39:48.066Z",
7 "name": null,
8 "platform": null,
9 "projects": [
10 {
11 "id": 1,
12 "name": "GitLab Community Edition",
13 "name_with_namespace": "GitLab.org / GitLab Community Edition",
14 "path": "gitlab-ce",
15 "path_with_namespace": "gitlab-org/gitlab-ce"
16 }
17 ],
18 "token": "205086a8e3b9a2b818ffac9b89d102",
19 "revision": null,
20 "tag_list": [
21 "ruby",
22 "mysql"
23 ],
24 "version": null
25 }
+0
-16
spec/fixtures/runners.json less more
0 [
1 {
2 "active": true,
3 "description": "test-1-20150125",
4 "id": 6,
5 "is_shared": false,
6 "name": null
7 },
8 {
9 "active": true,
10 "description": "test-2-20150125",
11 "id": 8,
12 "is_shared": false,
13 "name": null
14 }
15 ]
+0
-30
spec/fixtures/runners_all.json less more
0 [
1 {
2 "active": true,
3 "description": "shared-runner-1",
4 "id": 1,
5 "is_shared": true,
6 "name": null
7 },
8 {
9 "active": true,
10 "description": "shared-runner-2",
11 "id": 3,
12 "is_shared": true,
13 "name": null
14 },
15 {
16 "active": true,
17 "description": "test-1-20150125",
18 "id": 6,
19 "is_shared": false,
20 "name": null
21 },
22 {
23 "active": true,
24 "description": "test-2-20150125",
25 "id": 8,
26 "is_shared": false,
27 "name": null
28 }
29 ]
+0
-1
spec/fixtures/service.json less more
0 {"id":38,"title":"Redmine","created_at":"2015-12-18T14:17:17.592+03:00","updated_at":"2015-12-18T17:55:09.594+03:00","active":true,"push_events":true,"issues_events":true,"merge_requests_events":true,"tag_push_events":true,"note_events":true,"build_events":false,"properties":{"description":"Redmine","project_url":"https://example.com/projects/test_project/issue","issues_url":"https://example.com/issues/:id","new_issue_url":"'https://example.com/projects/test_project/issues/new"}}
+0
-1
spec/fixtures/session.json less more
0 {"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z","private_token":"qEsq1pt6HJPaNciie3MG"}
+0
-2
spec/fixtures/shell_history.json less more
0 party on, dudes
1 be excellent to each other
+0
-1
spec/fixtures/snippet.json less more
0 {"id":1,"title":"Rails Console ActionMailer","file_name":"mailer_test.rb","author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"expires_at":"2012-09-24T00:00:00Z","updated_at":"2012-09-17T09:51:42Z","created_at":"2012-09-17T09:51:42Z"}
+0
-16
spec/fixtures/snippet_award_emoji.json less more
0 {
1 "id": 4,
2 "name": "blowfish",
3 "user": {
4 "name": "Administrator",
5 "username": "root",
6 "id": 1,
7 "state": "active",
8 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
9 "web_url": "http://gitlab.example.com/root"
10 },
11 "created_at": "2016-06-15T10:09:34.206Z",
12 "updated_at": "2016-06-15T10:09:34.206Z",
13 "awardable_id": 80,
14 "awardable_type": "Snippet"
15 }
+0
-34
spec/fixtures/snippet_award_emojis.json less more
0 [
1 {
2 "id": 4,
3 "name": "1234",
4 "user": {
5 "name": "Administrator",
6 "username": "root",
7 "id": 1,
8 "state": "active",
9 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
10 "web_url": "http://gitlab.example.com/root"
11 },
12 "created_at": "2016-06-15T10:09:34.206Z",
13 "updated_at": "2016-06-15T10:09:34.206Z",
14 "awardable_id": 80,
15 "awardable_type": "Snippet"
16 },
17 {
18 "id": 1,
19 "name": "microphone",
20 "user": {
21 "name": "User 4",
22 "username": "user4",
23 "id": 26,
24 "state": "active",
25 "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon",
26 "web_url": "http://gitlab.example.com/user4"
27 },
28 "created_at": "2016-06-15T10:09:34.177Z",
29 "updated_at": "2016-06-15T10:09:34.177Z",
30 "awardable_id": 80,
31 "awardable_type": "Snippet"
32 }
33 ]
+0
-3
spec/fixtures/snippet_content.json less more
0 #!/usr/bin/env ruby
1
2 puts "Cool snippet!"
+0
-1
spec/fixtures/snippets.json less more
0 [{"id":1,"title":"Rails Console ActionMailer","file_name":"mailer_test.rb","author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"expires_at":"2012-09-24T00:00:00Z","updated_at":"2012-09-17T09:51:42Z","created_at":"2012-09-17T09:51:42Z"}]
+0
-1
spec/fixtures/system_hook.json less more
0 {"id": 3, "url": "http://example.com/hook", "created_at": "2013-10-02T10:15:31Z"}
+0
-1
spec/fixtures/system_hooks.json less more
0 [{"id": 3, "url": "http://example.com/hook", "created_at": "2013-10-02T10:15:31Z"}]
+0
-1
spec/fixtures/tag.json less more
0 {"name":"0.0.1","message":null,"commit":{"id":"c260c39f4d73d9087482d29b4d7a88bec834a3d1","message":"rubocop 100%","parent_ids":["b55be4dc5c052fb0058ef1ea96acd5e4e37f1bed"],"authored_date":"2016-04-29T16:11:32.000+01:00","author_name":"Bob Bloggs","author_email":"bob.bloggs@nowhere","committed_date":"2016-04-29T16:11:32.000+01:00","committer_name":"Bob Bloggs","committer_email":"bob.bloggs@nowhere"},"release":null}
+0
-1
spec/fixtures/tag_create.json less more
0 {"name":"0.0.1","message":"this tag is annotated","commit":{"id":"3d3f9288d70f75aa55ea495a3ed5948a628fce11","message":"Added README.md\n","parent_ids":[],"authored_date":"2016-05-25T11:23:07.000+01:00","author_name":"Bob Bloggs","author_email":"bob.bloggs@nowhere","committed_date":"2016-05-25T11:23:07.000+01:00","committer_name":"Bob Bloggs","committer_email":"bob.bloggs@nowhere"},"release":{"tag_name":"0.0.1","description":"and it has release notes"}}
+0
-1
spec/fixtures/tag_create_with_description.json less more
0 {"name":"0.0.1","message":"this tag is annotated","commit":{"id":"7225ddbe28add8d168e3175266830ab8e6aabdcc","message":"Readme updated","parent_ids":["c3f101968138aa9b09a92c8b6399b3269d17865e"],"authored_date":"2016-03-07T13:38:07.000+00:00","author_name":"Bob Bloggs","author_email":"bob.bloggs@nowhere","committed_date":"2016-03-07T13:38:07.000+00:00","committer_name":"Bob Bloggs","committer_email":"bob.bloggs@nowhere"},"release":null}
+0
-1
spec/fixtures/tag_delete.json less more
0 {"tag_name":"0.0.1"}
+0
-1
spec/fixtures/tags.json less more
0 [{"name":"0.0.2","message":null,"commit":{"id":"c260c39f4d73d9087482d29b4d7a88bec834a3d1","message":"rubocop 100%","parent_ids":["b55be4dc5c052fb0058ef1ea96acd5e4e37f1bed"],"authored_date":"2016-04-29T16:11:32.000+01:00","author_name":"Bob Bloggs","author_email":"bob.bloggs@nowhere","committed_date":"2016-04-29T16:11:32.000+01:00","committer_name":"Bob Bloggs","committer_email":"bob.bloggs@nowhere"},"release":null},{"name":"0.0.1","message":null,"commit":{"id":"c260c39f4d73d9087482d29b4d7a88bec834a3d1","message":"rubocop 100%","parent_ids":["b55be4dc5c052fb0058ef1ea96acd5e4e37f1bed"],"authored_date":"2016-04-29T16:11:32.000+01:00","author_name":"Bob Bloggs","author_email":"bob.bloggs@nowhere","committed_date":"2016-04-29T16:11:32.000+01:00","committer_name":"Bob Bloggs","committer_email":"bob.bloggs@nowhere"},"release":null}]
+0
-1
spec/fixtures/team_member.json less more
0 {"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z","access_level":40}
+0
-1
spec/fixtures/team_members.json less more
0 [{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z","access_level":40},{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z","access_level":20},{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","blocked":false,"created_at":"2012-09-17T09:42:03Z","access_level":40},{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","blocked":false,"created_at":"2012-09-17T09:42:03Z","access_level":40},{"id":6,"email":"faye.watsica@rohanwalter.com","name":"Ambrose Hansen","blocked":false,"created_at":"2012-09-17T09:42:03Z","access_level":40},{"id":7,"email":"maida@walshtorp.name","name":"Alana Hahn","blocked":false,"created_at":"2012-09-17T09:42:03Z","access_level":20}]
+0
-73
spec/fixtures/todo.json less more
0 {
1 "id": 102,
2 "project": {
3 "id": 2,
4 "name": "Gitlab Ce",
5 "name_with_namespace": "Gitlab Org / Gitlab Ce",
6 "path": "gitlab-ce",
7 "path_with_namespace": "gitlab-org/gitlab-ce"
8 },
9 "author": {
10 "name": "Administrator",
11 "username": "root",
12 "id": 1,
13 "state": "active",
14 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
15 "web_url": "https://gitlab.example.com/root"
16 },
17 "action_name": "marked",
18 "target_type": "MergeRequest",
19 "target": {
20 "id": 34,
21 "iid": 7,
22 "project_id": 2,
23 "title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
24 "description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.",
25 "state": "opened",
26 "created_at": "2016-06-17T07:49:24.419Z",
27 "updated_at": "2016-06-17T07:52:43.484Z",
28 "target_branch": "tutorials_git_tricks",
29 "source_branch": "DNSBL_docs",
30 "upvotes": 0,
31 "downvotes": 0,
32 "author": {
33 "name": "Maxie Medhurst",
34 "username": "craig_rutherford",
35 "id": 12,
36 "state": "active",
37 "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
38 "web_url": "https://gitlab.example.com/craig_rutherford"
39 },
40 "assignee": {
41 "name": "Administrator",
42 "username": "root",
43 "id": 1,
44 "state": "active",
45 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
46 "web_url": "https://gitlab.example.com/root"
47 },
48 "source_project_id": 2,
49 "target_project_id": 2,
50 "labels": [],
51 "work_in_progress": false,
52 "milestone": {
53 "id": 32,
54 "iid": 2,
55 "project_id": 2,
56 "title": "v1.0",
57 "description": "Assumenda placeat ea voluptatem voluptate qui.",
58 "state": "active",
59 "created_at": "2016-06-17T07:47:34.163Z",
60 "updated_at": "2016-06-17T07:47:34.163Z",
61 "due_date": null
62 },
63 "merge_when_pipeline_succeeds": false,
64 "merge_status": "cannot_be_merged",
65 "subscribed": true,
66 "user_notes_count": 7
67 },
68 "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ce/merge_requests/7",
69 "body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
70 "state": "done",
71 "created_at": "2016-06-17T07:52:35.225Z"
72 }
+0
-148
spec/fixtures/todos.json less more
0 [
1 {
2 "id": 102,
3 "project": {
4 "id": 2,
5 "name": "Gitlab Ce",
6 "name_with_namespace": "Gitlab Org / Gitlab Ce",
7 "path": "gitlab-ce",
8 "path_with_namespace": "gitlab-org/gitlab-ce"
9 },
10 "author": {
11 "name": "Administrator",
12 "username": "root",
13 "id": 1,
14 "state": "active",
15 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
16 "web_url": "https://gitlab.example.com/root"
17 },
18 "action_name": "marked",
19 "target_type": "MergeRequest",
20 "target": {
21 "id": 34,
22 "iid": 7,
23 "project_id": 2,
24 "title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
25 "description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.",
26 "state": "opened",
27 "created_at": "2016-06-17T07:49:24.419Z",
28 "updated_at": "2016-06-17T07:52:43.484Z",
29 "target_branch": "tutorials_git_tricks",
30 "source_branch": "DNSBL_docs",
31 "upvotes": 0,
32 "downvotes": 0,
33 "author": {
34 "name": "Maxie Medhurst",
35 "username": "craig_rutherford",
36 "id": 12,
37 "state": "active",
38 "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
39 "web_url": "https://gitlab.example.com/craig_rutherford"
40 },
41 "assignee": {
42 "name": "Administrator",
43 "username": "root",
44 "id": 1,
45 "state": "active",
46 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
47 "web_url": "https://gitlab.example.com/root"
48 },
49 "source_project_id": 2,
50 "target_project_id": 2,
51 "labels": [],
52 "work_in_progress": false,
53 "milestone": {
54 "id": 32,
55 "iid": 2,
56 "project_id": 2,
57 "title": "v1.0",
58 "description": "Assumenda placeat ea voluptatem voluptate qui.",
59 "state": "active",
60 "created_at": "2016-06-17T07:47:34.163Z",
61 "updated_at": "2016-06-17T07:47:34.163Z",
62 "due_date": null
63 },
64 "merge_when_pipeline_succeeds": false,
65 "merge_status": "cannot_be_merged",
66 "subscribed": true,
67 "user_notes_count": 7
68 },
69 "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ce/merge_requests/7",
70 "body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
71 "state": "pending",
72 "created_at": "2016-06-17T07:52:35.225Z"
73 },
74 {
75 "id": 98,
76 "project": {
77 "id": 2,
78 "name": "Gitlab Ce",
79 "name_with_namespace": "Gitlab Org / Gitlab Ce",
80 "path": "gitlab-ce",
81 "path_with_namespace": "gitlab-org/gitlab-ce"
82 },
83 "author": {
84 "name": "Maxie Medhurst",
85 "username": "craig_rutherford",
86 "id": 12,
87 "state": "active",
88 "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
89 "web_url": "https://gitlab.example.com/craig_rutherford"
90 },
91 "action_name": "assigned",
92 "target_type": "MergeRequest",
93 "target": {
94 "id": 34,
95 "iid": 7,
96 "project_id": 2,
97 "title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
98 "description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.",
99 "state": "opened",
100 "created_at": "2016-06-17T07:49:24.419Z",
101 "updated_at": "2016-06-17T07:52:43.484Z",
102 "target_branch": "tutorials_git_tricks",
103 "source_branch": "DNSBL_docs",
104 "upvotes": 0,
105 "downvotes": 0,
106 "author": {
107 "name": "Maxie Medhurst",
108 "username": "craig_rutherford",
109 "id": 12,
110 "state": "active",
111 "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
112 "web_url": "https://gitlab.example.com/craig_rutherford"
113 },
114 "assignee": {
115 "name": "Administrator",
116 "username": "root",
117 "id": 1,
118 "state": "active",
119 "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
120 "web_url": "https://gitlab.example.com/root"
121 },
122 "source_project_id": 2,
123 "target_project_id": 2,
124 "labels": [],
125 "work_in_progress": false,
126 "milestone": {
127 "id": 32,
128 "iid": 2,
129 "project_id": 2,
130 "title": "v1.0",
131 "description": "Assumenda placeat ea voluptatem voluptate qui.",
132 "state": "active",
133 "created_at": "2016-06-17T07:47:34.163Z",
134 "updated_at": "2016-06-17T07:47:34.163Z",
135 "due_date": null
136 },
137 "merge_when_pipeline_succeeds": false,
138 "merge_status": "cannot_be_merged",
139 "subscribed": true,
140 "user_notes_count": 7
141 },
142 "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ce/merge_requests/7",
143 "body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
144 "state": "pending",
145 "created_at": "2016-06-17T07:49:24.624Z"
146 }
147 ]
+0
-1
spec/fixtures/tree.json less more
0 [{"id":"a2cc3b0ffc1c7d06fab5642eb99ea387b57f22f8","name":"app","type":"tree","mode":"040000"},{"id":"63164bdfbc11b69f1032fbe35da0f1e9c18af2fd","name":"bin","type":"tree","mode":"040000"},{"id":"2cf682191722f20f00a371d7da58f6a35701c11d","name":"config","type":"tree","mode":"040000"},{"id":"2e76c8c1bbc46bcc762788a432d802d65a534a28","name":"db","type":"tree","mode":"040000"},{"id":"767cfc8360b50c50bb5bdde288b96a84e3efa66e","name":"doc","type":"tree","mode":"040000"},{"id":"3fa0d1024f5e372bf9e43d1dac47bd1e95ab0858","name":"lib","type":"tree","mode":"040000"},{"id":"4e79d0ac6225844602a1b9273b26d8996f777bf2","name":"log","type":"tree","mode":"040000"},{"id":"7cb7f593c6914d20fa6cc4ab5a7c34337a50e97c","name":"public","type":"tree","mode":"040000"},{"id":"d97169eef778f3cd1d4d94cbe3415b3166d15c71","name":"spec","type":"tree","mode":"040000"},{"id":"97c97da29fa97e2158cfdcdcb042af9da0bc3de4","name":"vendor","type":"tree","mode":"040000"},{"id":"d316760e4746059c117007507594a1d75b47df38","name":".gitignore","type":"blob","mode":"100644"},{"id":"f2e7cd477536f18d8e939faf452930b59a27063d","name":".travis.yml","type":"blob","mode":"100644"},{"id":"d5c68bda5f0fe703a80906f66cfe537ca807a5a6","name":"Capfile","type":"blob","mode":"100644"},{"id":"8f46eac03c6cd7ce03cda7ec3d78afdc6971e4c0","name":"Gemfile","type":"blob","mode":"100644"},{"id":"5e260573173b51eaa073661d7914fb0e935ee27f","name":"Gemfile.lock","type":"blob","mode":"100644"},{"id":"e57032f682b69f14243c09d66a0892a03b4c6045","name":"Procfile","type":"blob","mode":"100644"},{"id":"905e96da839dad683dfcf4e202bf1e030390b964","name":"README.md","type":"blob","mode":"100644"},{"id":"24a16769fd94926350a59f7b1cbd78e9e2674c57","name":"Rakefile","type":"blob","mode":"100644"},{"id":"b384d6d57c6a775a9b6bc35d79ad7f03e673a233","name":"config.ru","type":"blob","mode":"100644"}]
+0
-10
spec/fixtures/trigger.json less more
0 {
1 "id": 10,
2 "description": "my trigger",
3 "created_at": "2016-01-07T09:53:58.235Z",
4 "deleted_at": null,
5 "last_used": null,
6 "token": "6d056f63e50fe6f8c5f8f4aa10edb7",
7 "updated_at": "2016-01-07T09:53:58.235Z",
8 "owner": null
9 }
+0
-12
spec/fixtures/triggers.json less more
0 [
1 {
2 "id": 10,
3 "description": "my trigger",
4 "created_at": "2016-01-07T09:53:58.235Z",
5 "deleted_at": null,
6 "last_used": null,
7 "token": "6d056f63e50fe6f8c5f8f4aa10edb7",
8 "updated_at": "2016-01-07T09:53:58.235Z",
9 "owner": null
10 }
11 ]
+0
-1
spec/fixtures/user.json less more
0 {"id":1,"email":"john@example.com","name":"John Smith","username":"john.smith","bio":null,"skype":"","linkedin":"","twitter":"john","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:41:56Z"}
+0
-1
spec/fixtures/user_block_unblock.json less more
0 true
+0
-1
spec/fixtures/user_email.json less more
0 {"id":1,"email":"email@example.com"}
+0
-1
spec/fixtures/user_emails.json less more
0 [{"id":1,"email":"email@example.com"},{"id":3,"email":"email2@example.com"}]
+0
-1
spec/fixtures/user_search.json less more
0 [{"id":1,"email":"john1@example.com","name":"John Smith 1","username":"john.smith1","bio":null,"skype":"","linkedin":"","twitter":"john1","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:41:56Z"},{"id":2,"email":"john2@example.com","name":"John Smith 2","username":"john.smith2","bio":null,"skype":"","linkedin":"","twitter":"john2","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:56Z"}]
+0
-1
spec/fixtures/users.json less more
0 [{"id":1,"email":"john@example.com","name":"John Smith","username":"john.smith","bio":null,"skype":"","linkedin":"","twitter":"john","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:41:56Z"},{"id":2,"email":"jack@example.com","name":"Jack Smith","username":"jack.smith","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"},{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","username":"beatrice.jewess","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"},{"id":4,"email":"nicole@mertz.com","name":"Felipe Davis","username":"felipe.davis","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"},{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","username":"michale.von","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"},{"id":6,"email":"faye.watsica@rohanwalter.com","name":"Ambrose Hansen","username":"ambrose.hansen","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"},{"id":7,"email":"maida@walshtorp.name","name":"Alana Hahn","username":"alana.hahn","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"}]
+0
-4
spec/fixtures/variable.json less more
0 {
1 "key": "VARIABLE",
2 "value": "the value"
3 }
+0
-10
spec/fixtures/variables.json less more
0 [
1 {
2 "key": "TEST_VARIABLE_1",
3 "value": "TEST_1"
4 },
5 {
6 "key": "TEST_VARIABLE_2",
7 "value": "TEST_2"
8 }
9 ]
+0
-57
spec/gitlab/cli_helpers_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::CLI::Helpers do
3 describe ".method_owners" do
4 before do
5 @methods = Gitlab::CLI::Helpers.method_owners
6 end
7 it "should return Array of Hashes containing method names and owners" do
8 expect(@methods).to be_a Array
9 expect(@methods.all? { |m| m.is_a? Hash }).to be true
10 expect(@methods.all? { |m| m.keys.sort === [:name, :owner] }).to be true
11 end
12 end
13
14 describe ".valid_command?" do
15 it "should return true when command is valid" do
16 expect(Gitlab::CLI::Helpers.valid_command? 'merge_requests').to be_truthy
17 end
18 it "should return false when command is NOT valid" do
19 expect(Gitlab::CLI::Helpers.valid_command? 'mmmmmerge_requests').to be_falsy
20 end
21 end
22
23 describe ".symbolize_keys" do
24 context "when input is a Hash" do
25 it "should return a Hash with symbols for keys" do
26 hash = { 'key1' => 'val1', 'key2' => 'val2' }
27 symbolized_hash = Gitlab::CLI::Helpers.symbolize_keys(hash)
28 expect(symbolized_hash).to eq(key1: 'val1', key2: 'val2')
29 end
30 end
31 context "when input is NOT a Hash" do
32 it "should return input untouched" do
33 array = [1, 2, 3]
34 new_array = Gitlab::CLI::Helpers.symbolize_keys(array)
35 expect(new_array).to eq([1, 2, 3])
36 end
37 end
38 end
39
40 describe ".yaml_load" do
41 context "when argument is a YAML string" do
42 it "should return Ruby objects" do
43 argument = "{foo: bar, sna: fu}"
44 output = Gitlab::CLI::Helpers.yaml_load argument
45 expect(output).to eq('foo' => 'bar', 'sna' => 'fu')
46 end
47 end
48
49 context "when input is NOT valid YAML" do
50 it "should raise" do
51 ruby_array = [1, 2, 3, 4]
52 expect { Gitlab::CLI::Helpers.yaml_load ruby_array }.to raise_error TypeError
53 end
54 end
55 end
56 end
+0
-119
spec/gitlab/cli_spec.rb less more
0 require 'spec_helper'
1 require 'json'
2
3 describe Gitlab::CLI do
4 describe ".run" do
5 context "when command is version" do
6 it "should show gem version" do
7 output = capture_output { Gitlab::CLI.run('-v') }
8 expect(output).to eq("Gitlab Ruby Gem #{Gitlab::VERSION}\n")
9 end
10 end
11
12 context "when command is info" do
13 it "should show environment info" do
14 output = capture_output { Gitlab::CLI.run('info') }
15 expect(output).to include("Gitlab endpoint is")
16 expect(output).to include("Gitlab private token is")
17 expect(output).to include("Ruby Version is")
18 expect(output).to include("Gitlab Ruby Gem")
19 end
20 end
21
22 context "when command is help" do
23 it "should show available actions" do
24 output = capture_output { Gitlab::CLI.run('help') }
25 expect(output).to include('Help Topics')
26 expect(output).to include('MergeRequests')
27 end
28 end
29
30 context "when command is user" do
31 before do
32 stub_get("/user", "user")
33 @output = capture_output { Gitlab::CLI.run('user') }
34 end
35
36 it "should show executed command" do
37 expect(@output).to include('Gitlab.user')
38 end
39
40 it "should show user data" do
41 expect(@output).to include('name')
42 expect(@output).to include('John Smith')
43 end
44 end
45
46 context "when command is users" do
47 before do
48 stub_get("/users", "users")
49 @output = capture_output { Gitlab::CLI.run('users') }
50 end
51
52 it "should show executed command" do
53 expect(@output).to include('Gitlab.users')
54 end
55
56 it "should show users data" do
57 expect(@output).to include('name')
58 expect(@output).to include('John Smith')
59 expect(@output).to include('Jack Smith')
60 end
61 end
62 end
63
64 describe ".start" do
65 context "when command with excluded fields" do
66 before do
67 stub_get("/user", "user")
68 args = ['user', '--except=id,email,name']
69 @output = capture_output { Gitlab::CLI.start(args) }
70 end
71
72 it "should show user data with excluded fields" do
73 expect(@output).to_not include('John Smith')
74 expect(@output).to include('bio')
75 expect(@output).to include('created_at')
76 end
77 end
78
79 context "when command with json output" do
80 before do
81 stub_get("/user", "user")
82 args = ['user', '--json']
83 @output = capture_output { Gitlab::CLI.start(args) }
84 end
85
86 it "should render output as json" do
87 expect(JSON.parse(@output)['result']).to eq(JSON.parse(File.read(File.dirname(__FILE__) + '/../fixtures/user.json')))
88 expect(JSON.parse(@output)['cmd']).to eq('Gitlab.user')
89 end
90 end
91
92 context "when command with required fields" do
93 before do
94 stub_get("/user", "user")
95 args = ['user', '--only=id,email,name']
96 @output = capture_output { Gitlab::CLI.start(args) }
97 end
98
99 it "should show user data with required fields" do
100 expect(@output).to include('id')
101 expect(@output).to include('name')
102 expect(@output).to include('email')
103 expect(@output).to include('John Smith')
104 expect(@output).to_not include('bio')
105 expect(@output).to_not include('created_at')
106 end
107 end
108
109 context "fetch project with namespace/repo" do
110 it "should encode delimiter" do
111 stub_get("/projects/gitlab-org%2Fgitlab-ce", "project")
112 args = ['project', 'gitlab-org/gitlab-ce']
113 @output = capture_output { Gitlab::CLI.start(args) }
114 expect(@output).to include('id')
115 end
116 end
117 end
118 end
+0
-391
spec/gitlab/client/award_emojis_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe '.award_emojis' do
4 context 'when issue award emojis' do
5 before do
6 stub_get("/projects/1/issues/80/award_emoji", "issue_award_emojis")
7 @emojis = Gitlab.award_emojis(1, 80, 'issue')
8 end
9
10 it "should get the correct resources" do
11 expect(a_get("/projects/1/issues/80/award_emoji")).to have_been_made
12 end
13
14 it "should return a paginated response of issue award emojis" do
15 expect(@emojis).to be_a Gitlab::PaginatedResponse
16 expect(@emojis.first.awardable_id).to eq(80)
17 expect(@emojis.first.awardable_type).to eq("Issue")
18 end
19 end
20
21 context 'when merge request award emojis' do
22 before do
23 stub_get("/projects/1/merge_requests/80/award_emoji", "merge_request_award_emojis")
24 @emojis = Gitlab.award_emojis(1, 80, 'merge_request')
25 end
26
27 it "should get the correct resources" do
28 expect(a_get("/projects/1/merge_requests/80/award_emoji")).to have_been_made
29 end
30
31 it "should return a paginated response of merge request award emojis" do
32 expect(@emojis).to be_a Gitlab::PaginatedResponse
33 expect(@emojis.first.awardable_id).to eq(80)
34 expect(@emojis.first.awardable_type).to eq("MergeRequest")
35 end
36 end
37
38 context 'when snippet award emojis' do
39 before do
40 stub_get("/projects/1/snippets/80/award_emoji", "snippet_award_emojis")
41 @emojis = Gitlab.award_emojis(1, 80, 'snippet')
42 end
43
44 it "should get the correct resources" do
45 expect(a_get("/projects/1/snippets/80/award_emoji")).to have_been_made
46 end
47
48 it "should return a paginated response of snippet award emojis" do
49 expect(@emojis).to be_a Gitlab::PaginatedResponse
50 expect(@emojis.first.awardable_id).to eq(80)
51 expect(@emojis.first.awardable_type).to eq("Snippet")
52 end
53 end
54 end
55
56 describe '.note_award_emojis' do
57 context 'when issue note award emojis' do
58 before do
59 stub_get("/projects/1/issues/80/notes/1/award_emoji", "note_award_emojis")
60 @note_emojis = Gitlab.note_award_emojis(1, 80, 'issue', 1)
61 end
62
63 it "should get the correct resources" do
64 expect(a_get("/projects/1/issues/80/notes/1/award_emoji")).to have_been_made
65 end
66
67 it "should return a paginated response of issue note award emojis" do
68 expect(@note_emojis).to be_a Gitlab::PaginatedResponse
69 expect(@note_emojis.first.awardable_id).to eq(1)
70 expect(@note_emojis.first.awardable_type).to eq("Note")
71 end
72 end
73
74 context 'when merge request note award emojis' do
75 before do
76 stub_get("/projects/1/merge_requests/80/notes/1/award_emoji", "note_award_emojis")
77 @note_emojis = Gitlab.note_award_emojis(1, 80, 'merge_request', 1)
78 end
79
80 it "should get the correct resources" do
81 expect(a_get("/projects/1/merge_requests/80/notes/1/award_emoji")).to have_been_made
82 end
83
84 it "should return a paginated response of merge request note award emojis" do
85 expect(@note_emojis).to be_a Gitlab::PaginatedResponse
86 expect(@note_emojis.first.awardable_id).to eq(1)
87 expect(@note_emojis.first.awardable_type).to eq("Note")
88 end
89 end
90
91 context 'when snippet note award emojis' do
92 before do
93 stub_get("/projects/1/snippets/80/notes/1/award_emoji", "note_award_emojis")
94 @note_emojis = Gitlab.note_award_emojis(1, 80, 'snippet', 1)
95 end
96
97 it "should get the correct resources" do
98 expect(a_get("/projects/1/snippets/80/notes/1/award_emoji")).to have_been_made
99 end
100
101 it "should return a paginated response of snippet note award emojis" do
102 expect(@note_emojis).to be_a Gitlab::PaginatedResponse
103 expect(@note_emojis.first.awardable_id).to eq(1)
104 expect(@note_emojis.first.awardable_type).to eq("Note")
105 end
106 end
107 end
108
109 describe '.award_emoji' do
110 context 'when issue award emoji' do
111 before do
112 stub_get("/projects/1/issues/80/award_emoji/4", "issue_award_emoji")
113 @emoji = Gitlab.award_emoji(1, 80, 'issue', 4)
114 end
115
116 it "should get the correct resource" do
117 expect(a_get("/projects/1/issues/80/award_emoji/4")).to have_been_made
118 end
119
120 it "should return information about an issue award emoji" do
121 expect(@emoji.id).to eq(4)
122 expect(@emoji.awardable_type).to eq("Issue")
123 expect(@emoji.awardable_id).to eq(80)
124 end
125 end
126
127 context 'when merge request award emoji' do
128 before do
129 stub_get("/projects/1/merge_requests/80/award_emoji/4", "merge_request_award_emoji")
130 @emoji = Gitlab.award_emoji(1, 80, 'merge_request', 4)
131 end
132
133 it "should get the correct resource" do
134 expect(a_get("/projects/1/merge_requests/80/award_emoji/4")).to have_been_made
135 end
136
137 it "should return information about a merge request award emoji" do
138 expect(@emoji.id).to eq(4)
139 expect(@emoji.awardable_type).to eq("MergeRequest")
140 expect(@emoji.awardable_id).to eq(80)
141 end
142 end
143
144 context 'when snippet award emoji' do
145 before do
146 stub_get("/projects/1/snippets/80/award_emoji/4", "snippet_award_emoji")
147 @emoji = Gitlab.award_emoji(1, 80, 'snippet', 4)
148 end
149
150 it "should get the correct resource" do
151 expect(a_get("/projects/1/snippets/80/award_emoji/4")).to have_been_made
152 end
153
154 it "should return information about a snippet award emoji" do
155 expect(@emoji.id).to eq(4)
156 expect(@emoji.awardable_type).to eq("Snippet")
157 expect(@emoji.awardable_id).to eq(80)
158 end
159 end
160 end
161
162 describe '.note_award_emoji' do
163 context 'when issue note award emoji' do
164 before do
165 stub_get("/projects/1/issues/80/notes/1/award_emoji/4", "note_award_emoji")
166 @note_emoji = Gitlab.note_award_emoji(1, 80, 'issue', 1, 4)
167 end
168
169 it "should get the correct resource" do
170 expect(a_get("/projects/1/issues/80/notes/1/award_emoji/4")).to have_been_made
171 end
172
173 it "should return information about an issue note award emoji" do
174 expect(@note_emoji.id).to eq(4)
175 expect(@note_emoji.awardable_type).to eq("Note")
176 expect(@note_emoji.awardable_id).to eq(1)
177 end
178 end
179
180 context 'when merge request note award emoji' do
181 before do
182 stub_get("/projects/1/merge_requests/80/notes/1/award_emoji/4", "note_award_emoji")
183 @note_emoji = Gitlab.note_award_emoji(1, 80, 'merge_request', 1, 4)
184 end
185
186 it "should get the correct resource" do
187 expect(a_get("/projects/1/merge_requests/80/notes/1/award_emoji/4")).to have_been_made
188 end
189
190 it "should return information about a merge request note award emoji" do
191 expect(@note_emoji.id).to eq(4)
192 expect(@note_emoji.awardable_type).to eq("Note")
193 expect(@note_emoji.awardable_id).to eq(1)
194 end
195 end
196
197 context 'when snippet note award emoji' do
198 before do
199 stub_get("/projects/1/snippets/80/notes/1/award_emoji/4", "note_award_emoji")
200 @note_emoji = Gitlab.note_award_emoji(1, 80, 'snippet', 1, 4)
201 end
202
203 it "should get the correct resource" do
204 expect(a_get("/projects/1/snippets/80/notes/1/award_emoji/4")).to have_been_made
205 end
206
207 it "should return information about a snippet note award emoji" do
208 expect(@note_emoji.id).to eq(4)
209 expect(@note_emoji.awardable_type).to eq("Note")
210 expect(@note_emoji.awardable_id).to eq(1)
211 end
212 end
213 end
214
215 describe '.create_award_emoji' do
216 context 'when issue award emoji' do
217 before do
218 stub_post("/projects/1/issues/80/award_emoji", "issue_award_emoji")
219 @emoji = Gitlab.create_award_emoji(1, 80, "issue", "blowfish")
220 end
221
222 it "should get the correct resource" do
223 expect(a_post("/projects/1/issues/80/award_emoji").
224 with(body: { name: 'blowfish' })).to have_been_made
225 end
226
227 it "should return correct information about the created issue award emoji" do
228 expect(@emoji.name).to eq('blowfish')
229 expect(@emoji.awardable_type).to eq('Issue')
230 end
231 end
232
233 context 'when merge request award emoji' do
234 before do
235 stub_post("/projects/1/merge_requests/80/award_emoji", "merge_request_award_emoji")
236 @emoji = Gitlab.create_award_emoji(1, 80, "merge_request", "blowfish")
237 end
238
239 it "should get the correct resource" do
240 expect(a_post("/projects/1/merge_requests/80/award_emoji").
241 with(body: { name: 'blowfish' })).to have_been_made
242 end
243
244 it "should return correct information about the created merge request award emoji" do
245 expect(@emoji.name).to eq('blowfish')
246 expect(@emoji.awardable_type).to eq('MergeRequest')
247 end
248 end
249
250 context 'when snippet award emoji' do
251 before do
252 stub_post("/projects/1/snippets/80/award_emoji", "snippet_award_emoji")
253 @emoji = Gitlab.create_award_emoji(1, 80, "snippet", "blowfish")
254 end
255
256 it "should get the correct resource" do
257 expect(a_post("/projects/1/snippets/80/award_emoji").
258 with(body: { name: 'blowfish' })).to have_been_made
259 end
260
261 it "should return correct information about the created snippet award emoji" do
262 expect(@emoji.name).to eq('blowfish')
263 expect(@emoji.awardable_type).to eq('Snippet')
264 end
265 end
266 end
267
268 describe '.create_note_award_emoji' do
269 context 'when issue note award emoji' do
270 before do
271 stub_post("/projects/1/issues/80/notes/1/award_emoji", "note_award_emoji")
272 @note_emoji = Gitlab.create_note_award_emoji(1, 80, "issue", 1, "mood_bubble_lightning")
273 end
274
275 it "should get the correct resource" do
276 expect(a_post("/projects/1/issues/80/notes/1/award_emoji").
277 with(body: { name: 'mood_bubble_lightning' })).to have_been_made
278 end
279
280 it "should return correct information about the created issue note award emoji" do
281 expect(@note_emoji.name).to eq('mood_bubble_lightning')
282 expect(@note_emoji.awardable_type).to eq('Note')
283 end
284 end
285
286 context 'when merge request note award emoji' do
287 before do
288 stub_post("/projects/1/merge_requests/80/notes/1/award_emoji", "note_award_emoji")
289 @note_emoji = Gitlab.create_note_award_emoji(1, 80, "merge_request", 1, "mood_bubble_lightning")
290 end
291
292 it "should get the correct resource" do
293 expect(a_post("/projects/1/merge_requests/80/notes/1/award_emoji").
294 with(body: { name: 'mood_bubble_lightning' })).to have_been_made
295 end
296
297 it "should return correct information about the created merge request note award emoji" do
298 expect(@note_emoji.name).to eq('mood_bubble_lightning')
299 expect(@note_emoji.awardable_type).to eq('Note')
300 end
301 end
302
303 context 'when snippet note award emoji' do
304 before do
305 stub_post("/projects/1/snippets/80/notes/1/award_emoji", "note_award_emoji")
306 @note_emoji = Gitlab.create_note_award_emoji(1, 80, "snippet", 1, "mood_bubble_lightning")
307 end
308
309 it "should get the correct resource" do
310 expect(a_post("/projects/1/snippets/80/notes/1/award_emoji").
311 with(body: { name: 'mood_bubble_lightning' })).to have_been_made
312 end
313
314 it "should return correct information about the created snippet note award emoji" do
315 expect(@note_emoji.name).to eq('mood_bubble_lightning')
316 expect(@note_emoji.awardable_type).to eq('Note')
317 end
318 end
319 end
320
321 describe '.delete_award_emoji' do
322 context 'when issue award emoji' do
323 before do
324 stub_delete("/projects/1/issues/80/award_emoji/4", "issue_award_emoji")
325 @emoji = Gitlab.delete_award_emoji(1, 80, "issue", 4)
326 end
327
328 it "should get the correct resource" do
329 expect(a_delete("/projects/1/issues/80/award_emoji/4")).to have_been_made
330 end
331 end
332
333 context 'when merge request award emoji' do
334 before do
335 stub_delete("/projects/1/merge_requests/80/award_emoji/4", "merge_request_award_emoji")
336 @emoji = Gitlab.delete_award_emoji(1, 80, "merge_request", 4)
337 end
338
339 it "should get the correct resource" do
340 expect(a_delete("/projects/1/merge_requests/80/award_emoji/4")).to have_been_made
341 end
342 end
343
344 context 'when snippet award emoji' do
345 before do
346 stub_delete("/projects/1/snippets/80/award_emoji/4", "snippet_award_emoji")
347 @emoji = Gitlab.delete_award_emoji(1, 80, "snippet", 4)
348 end
349
350 it "should get the correct resource" do
351 expect(a_delete("/projects/1/snippets/80/award_emoji/4")).to have_been_made
352 end
353 end
354 end
355
356 describe '.delete_note_award_emoji' do
357 context 'when issue note award emoji' do
358 before do
359 stub_delete("/projects/1/issues/80/notes/1/award_emoji/4", "note_award_emoji")
360 @note_emoji = Gitlab.delete_note_award_emoji(1, 80, "issue", 1, 4)
361 end
362
363 it "should get the correct resource" do
364 expect(a_delete("/projects/1/issues/80/notes/1/award_emoji/4")).to have_been_made
365 end
366 end
367
368 context 'when merge request note award emoji' do
369 before do
370 stub_delete("/projects/1/merge_requests/80/notes/1/award_emoji/4", "note_award_emoji")
371 @note_emoji = Gitlab.delete_note_award_emoji(1, 80, "merge_request", 1, 4)
372 end
373
374 it "should get the correct resource" do
375 expect(a_delete("/projects/1/merge_requests/80/notes/1/award_emoji/4")).to have_been_made
376 end
377 end
378
379 context 'when snippet note award emoji' do
380 before do
381 stub_delete("/projects/1/snippets/80/notes/1/award_emoji/4", "note_award_emoji")
382 @note_emoji = Gitlab.delete_note_award_emoji(1, 80, "snippet", 1, 4)
383 end
384
385 it "should get the correct resource" do
386 expect(a_delete("/projects/1/snippets/80/notes/1/award_emoji/4")).to have_been_made
387 end
388 end
389 end
390 end
+0
-94
spec/gitlab/client/boards_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".boards" do
4 before do
5 stub_get("/projects/3/boards", "boards")
6 @boards = Gitlab.boards(3)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/boards")).to have_been_made
11 end
12
13 it "should return a paginated response of project's boards" do
14 expect(@boards).to be_a Gitlab::PaginatedResponse
15 end
16 end
17
18 describe ".board_lists" do
19 before do
20 stub_get("/projects/3/boards/1/lists", "board_lists")
21 @board_lists = Gitlab.board_lists(3, 1)
22 end
23
24 it "should get the correct resource" do
25 expect(a_get("/projects/3/boards/1/lists")).to have_been_made
26 end
27
28 it "should return a paginated response of board's lists" do
29 expect(@board_lists).to be_a Gitlab::PaginatedResponse
30 expect(@board_lists.first.id).to eq(1)
31 end
32 end
33
34 describe ".board_list" do
35 before do
36 stub_get("/projects/3/boards/1/lists/1", "board_list")
37 @board_list = Gitlab.board_list(3, 1, 1)
38 end
39
40 it "should get the correct resource" do
41 expect(a_get("/projects/3/boards/1/lists/1")).to have_been_made
42 end
43
44 it "should return information about the list" do
45 expect(@board_list.id).to eq(1)
46 end
47 end
48
49 describe ".create_board_list" do
50 before do
51 stub_post("/projects/3/boards/1/lists", "board_list")
52 @board_list = Gitlab.create_board_list(3, 1, 4)
53 end
54
55 it "should get the correct resource" do
56 expect(a_post("/projects/3/boards/1/lists")).to have_been_made
57 end
58
59 it "should return information about a created board" do
60 expect(@board_list.position).to eq(1)
61 end
62 end
63
64 describe ".edit_board_list" do
65 before do
66 stub_put("/projects/3/boards/1/lists/1", "board_list")
67 @board_list = Gitlab.edit_board_list(3, 1, 1, 3)
68 end
69
70 it "should get the correct resource" do
71 expect(a_put("/projects/3/boards/1/lists/1")).to have_been_made
72 end
73
74 it "should return information about an edited board" do
75 expect(@board_list.id).to eq(1)
76 end
77 end
78
79 describe ".delete_board_list" do
80 before do
81 stub_delete("/projects/3/boards/1/lists/1", "board_list")
82 @board_list = Gitlab.delete_board_list(3, 1, 1)
83 end
84
85 it "should get the correct resource" do
86 expect(a_delete("/projects/3/boards/1/lists/1")).to have_been_made
87 end
88
89 it "should return information about the deleted board list" do
90 expect(@board_list.id).to eq(1)
91 end
92 end
93 end
+0
-116
spec/gitlab/client/branches_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 it { should respond_to :repo_branches }
4 it { should respond_to :repo_branch }
5 it { should respond_to :repo_protect_branch }
6 it { should respond_to :repo_unprotect_branch }
7
8 describe ".branches" do
9 before do
10 stub_get("/projects/3/repository/branches", "branches")
11 @branches = Gitlab.branches(3)
12 end
13
14 it "should get the correct resource" do
15 expect(a_get("/projects/3/repository/branches")).to have_been_made
16 end
17
18 it "should return a paginated response of repository branches" do
19 expect(@branches).to be_a Gitlab::PaginatedResponse
20 expect(@branches.first.name).to eq("api")
21 end
22 end
23
24 describe ".branch" do
25 before do
26 stub_get("/projects/3/repository/branches/api", "branch")
27 @branch = Gitlab.branch(3, "api")
28 end
29
30 it "should get the correct resource" do
31 expect(a_get("/projects/3/repository/branches/api")).to have_been_made
32 end
33
34 it "should return information about a repository branch" do
35 expect(@branch.name).to eq("api")
36 end
37 end
38
39 describe ".protect_branch" do
40 before do
41 stub_put("/projects/3/repository/branches/api/protect", "branch")
42 end
43
44 context "without options" do
45 before do
46 @branch = Gitlab.protect_branch(3, "api")
47 end
48
49 it "should update the correct resource" do
50 expect(a_put("/projects/3/repository/branches/api/protect")).to have_been_made
51 end
52
53 it "should return information about a protected repository branch" do
54 expect(@branch.name).to eq("api")
55 end
56 end
57
58 context "with options" do
59 before do
60 @branch = Gitlab.protect_branch(3, "api", developers_can_push: true)
61 end
62
63 it "should update the correct resource with the correct options" do
64 expect(
65 a_put("/projects/3/repository/branches/api/protect").with(body: { developers_can_push: 'true' })
66 ).to have_been_made
67 end
68 end
69 end
70
71 describe ".unprotect_branch" do
72 before do
73 stub_put("/projects/3/repository/branches/api/unprotect", "branch")
74 @branch = Gitlab.unprotect_branch(3, "api")
75 end
76
77 it "should get the correct resource" do
78 expect(a_put("/projects/3/repository/branches/api/unprotect")).to have_been_made
79 end
80
81 it "should return information about an unprotected repository branch" do
82 expect(@branch.name).to eq("api")
83 end
84 end
85
86 describe ".create_branch" do
87 before do
88 stub_post("/projects/3/repository/branches", "branch")
89 @branch = Gitlab.create_branch(3, "api", "master")
90 end
91
92 it "should get the correct resource" do
93 expect(a_post("/projects/3/repository/branches")).to have_been_made
94 end
95
96 it "should return information about a new repository branch" do
97 expect(@branch.name).to eq("api")
98 end
99 end
100
101 describe ".delete_branch" do
102 before do
103 stub_delete("/projects/3/repository/branches/api", "branch_delete")
104 @branch = Gitlab.delete_branch(3, "api")
105 end
106
107 it "should get the correct resource" do
108 expect(a_delete("/projects/3/repository/branches/api")).to have_been_made
109 end
110
111 it "should return information about the deleted repository branch" do
112 expect(@branch.branch_name).to eq("api")
113 end
114 end
115 end
+0
-86
spec/gitlab/client/build_variables_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".variables" do
4 before do
5 stub_get("/projects/3/variables", "variables")
6 @variables = Gitlab.variables(3)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/variables")).to have_been_made
11 end
12
13 it "should return an array of project's variables" do
14 expect(@variables).to be_a Gitlab::PaginatedResponse
15 expect(@variables.first.key).to eq("TEST_VARIABLE_1")
16 expect(@variables.first.value).to eq("TEST_1")
17 end
18 end
19
20 describe ".variable" do
21 before do
22 stub_get("/projects/3/variables/VARIABLE", "variable")
23 @variable = Gitlab.variable(3, "VARIABLE")
24 end
25
26 it "should get the correct resource" do
27 expect(a_get("/projects/3/variables/VARIABLE")).to have_been_made
28 end
29
30 it "should return information about a variable" do
31 expect(@variable.key).to eq("VARIABLE")
32 expect(@variable.value).to eq("the value")
33 end
34 end
35
36 describe ".create_variable" do
37 before do
38 stub_post("/projects/3/variables", "variable")
39 @variable = Gitlab.create_variable(3, "NEW_VARIABLE", "new value")
40 end
41
42 it "should get the correct resource" do
43 body = { key: "NEW_VARIABLE", value: "new value" }
44 expect(a_post("/projects/3/variables").with(body: body)).to have_been_made
45 end
46
47 it "should return information about a new variable" do
48 expect(@variable.key).to eq("VARIABLE")
49 expect(@variable.value).to eq("the value")
50 end
51 end
52
53 describe ".update_variable" do
54 before do
55 stub_put("/projects/3/variables/UPD_VARIABLE", "variable")
56 @variable = Gitlab.update_variable(3, "UPD_VARIABLE", "updated value")
57 end
58
59 it "should put the correct resource" do
60 body = { value: "updated value" }
61 expect(a_put("/projects/3/variables/UPD_VARIABLE").with(body: body)).to have_been_made
62 end
63
64 it "should return information about an updated variable" do
65 expect(@variable.key).to eq("VARIABLE")
66 expect(@variable.value).to eq("the value")
67 end
68 end
69
70 describe ".remove_variable" do
71 before do
72 stub_delete("/projects/3/variables/DEL_VARIABLE", "variable")
73 @variable = Gitlab.remove_variable(3, "DEL_VARIABLE")
74 end
75
76 it "should get the correct resource" do
77 expect(a_delete("/projects/3/variables/DEL_VARIABLE")).to have_been_made
78 end
79
80 it "should return information about a deleted variable" do
81 expect(@variable.key).to eq("VARIABLE")
82 expect(@variable.value).to eq("the value")
83 end
84 end
85 end
+0
-148
spec/gitlab/client/builds_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".builds" do
4 before do
5 stub_get("/projects/3/builds", "builds")
6 @builds = Gitlab.builds(3)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/builds")).to have_been_made
11 end
12
13 it "should return a paginated response of project's builds" do
14 expect(@builds).to be_a Gitlab::PaginatedResponse
15 end
16 end
17
18 describe ".build" do
19 before do
20 stub_get("/projects/3/builds/8", "build")
21 @build = Gitlab.build(3, 8)
22 end
23
24 it "should get the correct resource" do
25 expect(a_get("/projects/3/builds/8")).to have_been_made
26 end
27
28 it "should return a single build" do
29 expect(@build).to be_a Gitlab::ObjectifiedHash
30 end
31
32 it "should return information about a build" do
33 expect(@build.id).to eq(8)
34 expect(@build.user.name).to eq("John Smith")
35 end
36 end
37
38 describe ".build_artifacts" do
39 context "when successful request" do
40 before do
41 fixture = load_fixture('build_artifacts')
42 fixture.set_encoding(Encoding::ASCII_8BIT)
43 stub_request(:get, "#{Gitlab.endpoint}/projects/3/builds/8/artifacts").
44 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
45 to_return(body: fixture.read, headers: { 'Content-Disposition' => "attachment; filename=artifacts.zip" })
46 @build_artifacts = Gitlab.build_artifacts(3, 8)
47 end
48
49 it "should get the correct resource" do
50 expect(a_get("/projects/3/builds/8/artifacts")).to have_been_made
51 end
52
53 it "should return a FileResponse" do
54 expect(@build_artifacts).to be_a Gitlab::FileResponse
55 end
56
57 it "should return a file with filename" do
58 expect(@build_artifacts.filename).to eq "artifacts.zip"
59 end
60 end
61
62 context "when bad request" do
63 it "should throw an exception" do
64 stub_get("/projects/3/builds/8/artifacts", "error_project_not_found", 404)
65 expect{ Gitlab.build_artifacts(3, 8) }.to raise_error(Gitlab::Error::NotFound, "Server responded with code 404, message: 404 Project Not Found. Request URI: #{Gitlab.endpoint}/projects/3/builds/8/artifacts")
66 end
67 end
68 end
69
70 describe ".builds_commits" do
71 before do
72 stub_get("/projects/3/repository/commits/0ff3ae198f8601a285adcf5c0fff204ee6fba5fd/builds", "builds_commits")
73 @builds_commits = Gitlab.commit_builds(3, "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd")
74 end
75
76 it "should get the correct resource" do
77 expect(a_get("/projects/3/repository/commits/0ff3ae198f8601a285adcf5c0fff204ee6fba5fd/builds")).to have_been_made
78 end
79
80 it "should return a paginated response of commit builds" do
81 expect(@builds_commits).to be_a Gitlab::PaginatedResponse
82 end
83
84 it "should return information about the builds" do
85 expect(@builds_commits.count).to eq(2)
86 end
87 end
88
89
90
91 describe ".build_cancel" do
92 before do
93 stub_post("/projects/3/builds/8/cancel", "build_cancel")
94 @build_cancel = Gitlab.build_cancel(3, 8)
95 end
96
97 it "should get the correct resource" do
98 expect(a_post("/projects/3/builds/8/cancel")).to have_been_made
99 end
100
101 it "should return a single build" do
102 expect(@build_cancel).to be_a Gitlab::ObjectifiedHash
103 end
104
105 it "should return information about a build" do
106 expect(@build_cancel.commit.author_name).to eq("John Smith")
107 end
108 end
109
110 describe ".build_retry" do
111 before do
112 stub_post("/projects/3/builds/69/retry", "build_retry")
113 @build_retry = Gitlab.build_retry(3, 69)
114 end
115
116 it "should get the correct resource" do
117 expect(a_post("/projects/3/builds/69/retry")).to have_been_made
118 end
119
120 it "should return a single build" do
121 expect(@build_retry).to be_a Gitlab::ObjectifiedHash
122 end
123
124 it "should return information about a build" do
125 expect(@build_retry.commit.author_name).to eq("John Smith")
126 end
127 end
128
129 describe ".build_erase" do
130 before do
131 stub_post("/projects/3/builds/69/erase", "build_erase")
132 @build_retry = Gitlab.build_erase(3, 69)
133 end
134
135 it "should get the correct resource" do
136 expect(a_post("/projects/3/builds/69/erase")).to have_been_made
137 end
138
139 it "should return a single build" do
140 expect(@build_retry).to be_a Gitlab::ObjectifiedHash
141 end
142
143 it "should return information about a build" do
144 expect(@build_retry.commit.author_name).to eq("John Smith")
145 end
146 end
147 end
+0
-11
spec/gitlab/client/client_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe '#inspect' do
4 it 'masks tokens on inspect' do
5 client = described_class.new(private_token: 'ui3gIYf4MMzTx-Oh5cEBx')
6 inspected = client.inspect
7 expect(inspected).to include('****************cEBx')
8 end
9 end
10 end
+0
-168
spec/gitlab/client/commits_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 it { should respond_to :repo_commits }
4 it { should respond_to :repo_commit }
5 it { should respond_to :repo_commit_diff }
6 it { should respond_to :repo_commit_comments }
7 it { should respond_to :repo_create_commit_comment }
8 it { should respond_to :repo_commit_status }
9 it { should respond_to :repo_update_commit_status }
10
11 describe ".commits" do
12 before do
13 stub_get("/projects/3/repository/commits", "project_commits").
14 with(query: { ref_name: "api" })
15 @commits = Gitlab.commits(3, ref_name: "api")
16 end
17
18 it "should get the correct resource" do
19 expect(a_get("/projects/3/repository/commits").
20 with(query: { ref_name: "api" })).to have_been_made
21 end
22
23 it "should return a paginated response of repository commits" do
24 expect(@commits).to be_a Gitlab::PaginatedResponse
25 expect(@commits.first.id).to eq("f7dd067490fe57505f7226c3b54d3127d2f7fd46")
26 end
27 end
28
29 describe ".commit" do
30 before do
31 stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6", "project_commit")
32 @commit = Gitlab.commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
33 end
34
35 it "should get the correct resource" do
36 expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6")).
37 to have_been_made
38 end
39
40 it "should return a repository commit" do
41 expect(@commit.id).to eq("6104942438c14ec7bd21c6cd5bd995272b3faff6")
42 end
43 end
44
45 describe ".commit_diff" do
46 before do
47 stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff", "project_commit_diff")
48 @diff = Gitlab.commit_diff(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
49 end
50
51 it "should get the correct resource" do
52 expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff")).
53 to have_been_made
54 end
55
56 it "should return a diff of a commit" do
57 expect(@diff.new_path).to eq("doc/update/5.4-to-6.0.md")
58 end
59 end
60
61 describe ".commit_comments" do
62 before do
63 stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments", "project_commit_comments")
64 @commit_comments = Gitlab.commit_comments(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6')
65 end
66
67 it "should get the correct resource" do
68 expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments")).
69 to have_been_made
70 end
71
72 it "should return commit's comments" do
73 expect(@commit_comments).to be_a Gitlab::PaginatedResponse
74 expect(@commit_comments.length).to eq(2)
75 expect(@commit_comments[0].note).to eq("this is the 1st comment on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6")
76 expect(@commit_comments[0].author.id).to eq(11)
77 expect(@commit_comments[1].note).to eq("another discussion point on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6")
78 expect(@commit_comments[1].author.id).to eq(12)
79 end
80 end
81
82 describe ".create_commit_comment" do
83 before do
84 stub_post("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments", "project_commit_comment")
85 @merge_request = Gitlab.create_commit_comment(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'Nice code!')
86 end
87
88 it "should return information about the newly created comment" do
89 expect(@merge_request.note).to eq('Nice code!')
90 expect(@merge_request.author.id).to eq(1)
91 end
92 end
93
94 describe ".commit_status" do
95 before do
96 stub_get("/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses", 'project_commit_status').
97 with(query: { all: 'true' })
98 @statuses = Gitlab.commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', all: true)
99 end
100
101 it "should get the correct resource" do
102 expect(a_get("/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses").
103 with(query: { all: true }))
104 end
105
106 it "should get statuses of a commit" do
107 expect(@statuses).to be_kind_of Gitlab::PaginatedResponse
108 expect(@statuses.first.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8')
109 expect(@statuses.first.ref).to eq('decreased-spec')
110 expect(@statuses.first.status).to eq('failed')
111 expect(@statuses.last.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8')
112 expect(@statuses.last.status).to eq('success')
113 end
114 end
115
116 describe ".update_commit_status" do
117 before do
118 stub_post("/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8", 'project_update_commit_status').
119 with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' })
120 @status = Gitlab.update_commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', 'failed', name: 'test', ref: 'decreased-spec')
121 end
122
123 it "should get the correct resource" do
124 expect(a_post('/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8').
125 with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' }))
126 end
127
128 it "should information about the newly created status" do
129 expect(@status).to be_kind_of Gitlab::ObjectifiedHash
130 expect(@status.id).to eq(498)
131 expect(@status.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8')
132 expect(@status.status).to eq('failed')
133 expect(@status.ref).to eq('decreased-spec')
134 end
135 end
136
137 describe ".create_commit" do
138 let(:actions) do
139 [
140 {
141 action: "create",
142 file_path: "foo/bar",
143 content: "some content"
144 }
145 ]
146 end
147
148 let(:query) do
149 {
150 branch: 'dev',
151 commit_message: 'refactors everything',
152 actions: actions,
153 author_email: 'joe@sample.org',
154 author_name: 'Joe Sample'
155 }
156 end
157
158 before do
159 stub_post("/projects/6/repository/commits", 'project_commit_create').with(body: query)
160 @commit = Gitlab.create_commit(6, 'dev', 'refactors everything', actions, {author_email: 'joe@sample.org', author_name: 'Joe Sample'})
161 end
162
163 it "should return id of a created commit" do
164 expect(@commit.id).to eq('ed899a2f4b50b4370feeea94676502b42383c746')
165 end
166 end
167 end
+0
-132
spec/gitlab/client/environments_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".environments" do
4 before do
5 stub_get("/projects/3/environments", "environments")
6 @environments = Gitlab.environments(3)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/environments")).to have_been_made
11 end
12
13 it "should return a paginated response of project's environments" do
14 expect(@environments).to be_a Gitlab::PaginatedResponse
15 end
16 end
17
18 describe ".environment" do
19 before do
20 stub_get("/projects/3/environments/12", "environment")
21 @environment = Gitlab.environment(3, 12)
22 end
23
24 it "should get the correct resource" do
25 expect(a_get("/projects/3/environments/12")).to have_been_made
26 end
27
28 it "should return a single environment" do
29 expect(@environment).to be_a Gitlab::ObjectifiedHash
30 end
31
32 it "should return information about an environment" do
33 expect(@environment.id).to eq(12)
34 expect(@environment.name).to eq("staging")
35 end
36 end
37
38 describe ".create_environment" do
39 context "without external_url" do
40 before do
41 stub_post("/projects/3/environments", "environment")
42 @environment = Gitlab.create_environment(3, 'staging')
43 end
44
45 it "should get the correct resource" do
46 expect(a_post("/projects/3/environments").with(body: { name: 'staging' })).to have_been_made
47 end
48
49 it "should return a single environment" do
50 expect(@environment).to be_a Gitlab::ObjectifiedHash
51 end
52
53 it "should return information about an environment" do
54 expect(@environment.name).to eq("staging")
55 end
56 end
57
58 context "with external_url" do
59 before do
60 stub_post("/projects/3/environments", "environment")
61 @environment = Gitlab.create_environment(3, 'staging', external_url: "https://staging.example.gitlab.com")
62 end
63
64 it "should get the correct resource" do
65 expect(a_post("/projects/3/environments")
66 .with(body: { name: 'staging', external_url: "https://staging.example.gitlab.com" })).to have_been_made
67 end
68 end
69 end
70
71 describe ".edit_environment" do
72 before do
73 stub_put("/projects/3/environments/12", "environment")
74 @environment = Gitlab.edit_environment(3, 12, {
75 name: 'staging',
76 external_url: "https://staging.example.gitlab.com"
77 })
78 end
79
80 it "should get the correct resource" do
81 expect(a_put("/projects/3/environments/12")
82 .with(body: { name: 'staging', external_url: "https://staging.example.gitlab.com" })).to have_been_made
83 end
84
85 it "should return a single environment" do
86 expect(@environment).to be_a Gitlab::ObjectifiedHash
87 end
88
89 it "should return information about an environment" do
90 expect(@environment.name).to eq("staging")
91 end
92 end
93
94 describe ".delete_environment" do
95 before do
96 stub_delete("/projects/3/environments/12", "environment")
97 @environment = Gitlab.delete_environment(3, 12)
98 end
99
100 it "should get the correct resource" do
101 expect(a_delete("/projects/3/environments/12")).to have_been_made
102 end
103
104 it "should return a single pipeline" do
105 expect(@environment).to be_a Gitlab::ObjectifiedHash
106 end
107
108 it "should return information about a pipeline" do
109 expect(@environment.name).to eq("staging")
110 end
111 end
112
113 describe ".stop_environment" do
114 before do
115 stub_post("/projects/3/environments/12/stop", "environment")
116 @environment = Gitlab.stop_environment(3, 12)
117 end
118
119 it "should get the correct resource" do
120 expect(a_post("/projects/3/environments/12/stop")).to have_been_made
121 end
122
123 it "should return a single pipeline" do
124 expect(@environment).to be_a Gitlab::ObjectifiedHash
125 end
126
127 it "should return information about a pipeline" do
128 expect(@environment.name).to eq("staging")
129 end
130 end
131 end
+0
-195
spec/gitlab/client/groups_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".groups" do
4 before do
5 stub_get("/groups", "groups")
6 stub_get("/groups/3", "group")
7 @group = Gitlab.group(3)
8 @groups = Gitlab.groups
9 end
10
11 it "should get the correct resource" do
12 expect(a_get("/groups")).to have_been_made
13 expect(a_get("/groups/3")).to have_been_made
14 end
15
16 it "should return a paginated response of groups" do
17 expect(@groups).to be_a Gitlab::PaginatedResponse
18 expect(@groups.first.path).to eq("threegroup")
19 end
20 end
21
22 describe ".create_group" do
23 context "without description" do
24 before do
25 stub_post("/groups", "group_create")
26 @group = Gitlab.create_group('GitLab-Group', 'gitlab-path')
27 end
28
29 it "should get the correct resource" do
30 expect(a_post("/groups").
31 with(body: { path: 'gitlab-path', name: 'GitLab-Group' })).to have_been_made
32 end
33
34 it "should return information about a created group" do
35 expect(@group.name).to eq("Gitlab-Group")
36 expect(@group.path).to eq("gitlab-group")
37 end
38 end
39
40 context "with description" do
41 before do
42 stub_post("/groups", "group_create_with_description")
43 @group = Gitlab.create_group('GitLab-Group', 'gitlab-path', description: 'gitlab group description')
44 end
45
46 it "should get the correct resource" do
47 expect(a_post("/groups").
48 with(body: { path: 'gitlab-path', name: 'GitLab-Group',
49 description: 'gitlab group description' })).to have_been_made
50 end
51
52 it "should return information about a created group" do
53 expect(@group.name).to eq("Gitlab-Group")
54 expect(@group.path).to eq("gitlab-group")
55 expect(@group.description).to eq("gitlab group description")
56 end
57 end
58 end
59
60 describe ".delete_group" do
61 before do
62 stub_delete("/groups/42", "group_delete")
63 @group = Gitlab.delete_group(42)
64 end
65
66 it "should get the correct resource" do
67 expect(a_delete("/groups/42")).to have_been_made
68 end
69
70 it "should return information about a deleted group" do
71 expect(@group.name).to eq("Gitlab-Group")
72 expect(@group.path).to eq("gitlab-group")
73 end
74 end
75
76 describe ".transfer_project_to_group" do
77 before do
78 stub_post("/projects", "project")
79 @project = Gitlab.create_project('Gitlab')
80 stub_post("/groups", "group_create")
81 @group = Gitlab.create_group('GitLab-Group', 'gitlab-path')
82
83 stub_post("/groups/#{@group.id}/projects/#{@project.id}", "group_create")
84 @group_transfer = Gitlab.transfer_project_to_group(@group.id, @project.id)
85 end
86
87 it "should post to the correct resource" do
88 expect(a_post("/groups/#{@group.id}/projects/#{@project.id}").with(body: { id: @group.id.to_s, project_id: @project.id.to_s })).to have_been_made
89 end
90
91 it "should return information about the group" do
92 expect(@group_transfer.name).to eq(@group.name)
93 expect(@group_transfer.path).to eq(@group.path)
94 expect(@group_transfer.id).to eq(@group.id)
95 end
96 end
97
98 describe ".group_members" do
99 before do
100 stub_get("/groups/3/members", "group_members")
101 @members = Gitlab.group_members(3)
102 end
103
104 it "should get the correct resource" do
105 expect(a_get("/groups/3/members")).to have_been_made
106 end
107
108 it "should return information about a group members" do
109 expect(@members).to be_a Gitlab::PaginatedResponse
110 expect(@members.size).to eq(2)
111 expect(@members[1].name).to eq("John Smith")
112 end
113 end
114
115 describe ".add_group_member" do
116 before do
117 stub_post("/groups/3/members", "group_member")
118 @member = Gitlab.add_group_member(3, 1, 40)
119 end
120
121 it "should get the correct resource" do
122 expect(a_post("/groups/3/members").
123 with(body: { user_id: '1', access_level: '40' })).to have_been_made
124 end
125
126 it "should return information about the added member" do
127 expect(@member.name).to eq("John Smith")
128 end
129 end
130
131 describe ".edit_group_member" do
132 before do
133 stub_put("/groups/3/members/1", "group_member_edit")
134 @member = Gitlab.edit_group_member(3, 1, 50)
135 end
136
137 it "should get the correct resource" do
138 expect(a_put("/groups/3/members/1")
139 .with(body: { access_level: '50'})).to have_been_made
140 end
141
142 it "should return information about the edited member" do
143 expect(@member.access_level).to eq(50)
144 end
145 end
146
147 describe ".remove_group_member" do
148 before do
149 stub_delete("/groups/3/members/1", "group_member_delete")
150 @group = Gitlab.remove_group_member(3, 1)
151 end
152
153 it "should get the correct resource" do
154 expect(a_delete("/groups/3/members/1")).to have_been_made
155 end
156
157 it "should return information about the group the member was removed from" do
158 expect(@group.group_id).to eq(3)
159 end
160 end
161
162 describe ".group_projects" do
163 before do
164 stub_get("/groups/4/projects", "group_projects")
165 @projects = Gitlab.group_projects(4)
166 end
167
168 it "should get the list of projects" do
169 expect(a_get("/groups/4/projects")).to have_been_made
170 end
171
172 it "should return a list of of projects under a group" do
173 expect(@projects).to be_a Gitlab::PaginatedResponse
174 expect(@projects.size).to eq(1)
175 expect(@projects[0].name).to eq("Diaspora Client")
176 end
177 end
178
179 describe ".group_search" do
180 before do
181 stub_get("/groups?search=Group", "group_search")
182 @groups = Gitlab.group_search('Group')
183 end
184
185 it "should get the correct resource" do
186 expect(a_get("/groups?search=Group")).to have_been_made
187 end
188
189 it "should return an array of groups found" do
190 expect(@groups.first.id).to eq(5)
191 expect(@groups.last.id).to eq(8)
192 end
193 end
194 end
+0
-186
spec/gitlab/client/issues_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".issues" do
4 context "with project ID passed" do
5 before do
6 stub_get("/projects/3/issues", "project_issues")
7 @issues = Gitlab.issues(3)
8 end
9
10 it "should get the correct resource" do
11 expect(a_get("/projects/3/issues")).to have_been_made
12 end
13
14 it "should return a paginated response of project's issues" do
15 expect(@issues).to be_a Gitlab::PaginatedResponse
16 expect(@issues.first.project_id).to eq(3)
17 end
18 end
19
20 context 'with literal project ID passed' do
21 before do
22 stub_get("/projects/gitlab-org%2Fgitlab-ce/issues", "project_issues")
23 @issues = Gitlab.issues('gitlab-org/gitlab-ce')
24 end
25
26 it "should get the correct resource" do
27 expect(a_get("/projects/gitlab-org%2Fgitlab-ce/issues")).to have_been_made
28 end
29
30 it "should return a paginated response of project's issues" do
31 expect(@issues).to be_a Gitlab::PaginatedResponse
32 expect(@issues.first.project_id).to eq(3)
33 end
34 end
35
36 context "without project ID passed" do
37 before do
38 stub_get("/issues", "issues")
39 @issues = Gitlab.issues
40 end
41
42 it "should get the correct resource" do
43 expect(a_get("/issues")).to have_been_made
44 end
45
46 it "should return a paginated response of user's issues" do
47 expect(@issues).to be_a Gitlab::PaginatedResponse
48 expect(@issues.first.closed).to be_falsey
49 expect(@issues.first.author.name).to eq("John Smith")
50 end
51 end
52 end
53
54 describe ".issue" do
55 before do
56 stub_get("/projects/3/issues/33", "issue")
57 @issue = Gitlab.issue(3, 33)
58 end
59
60 it "should get the correct resource" do
61 expect(a_get("/projects/3/issues/33")).to have_been_made
62 end
63
64 it "should return information about an issue" do
65 expect(@issue.project_id).to eq(3)
66 expect(@issue.assignee.name).to eq("Jack Smith")
67 end
68 end
69
70 describe ".create_issue" do
71 before do
72 stub_post("/projects/3/issues", "issue")
73 @issue = Gitlab.create_issue(3, 'title')
74 end
75
76 it "should get the correct resource" do
77 expect(a_post("/projects/3/issues").
78 with(body: { title: 'title' })).to have_been_made
79 end
80
81 it "should return information about a created issue" do
82 expect(@issue.project_id).to eq(3)
83 expect(@issue.assignee.name).to eq("Jack Smith")
84 end
85 end
86
87 describe ".edit_issue" do
88 before do
89 stub_put("/projects/3/issues/33", "issue")
90 @issue = Gitlab.edit_issue(3, 33, title: 'title')
91 end
92
93 it "should get the correct resource" do
94 expect(a_put("/projects/3/issues/33").
95 with(body: { title: 'title' })).to have_been_made
96 end
97
98 it "should return information about an edited issue" do
99 expect(@issue.project_id).to eq(3)
100 expect(@issue.assignee.name).to eq("Jack Smith")
101 end
102 end
103
104 describe ".close_issue" do
105 before do
106 stub_put("/projects/3/issues/33", "issue")
107 @issue = Gitlab.close_issue(3, 33)
108 end
109
110 it "should get the correct resource" do
111 expect(a_put("/projects/3/issues/33").
112 with(body: { state_event: 'close' })).to have_been_made
113 end
114
115 it "should return information about an closed issue" do
116 expect(@issue.project_id).to eq(3)
117 expect(@issue.assignee.name).to eq("Jack Smith")
118 end
119 end
120
121 describe ".reopen_issue" do
122 before do
123 stub_put("/projects/3/issues/33", "issue")
124 @issue = Gitlab.reopen_issue(3, 33)
125 end
126
127 it "should get the correct resource" do
128 expect(a_put("/projects/3/issues/33").
129 with(body: { state_event: 'reopen' })).to have_been_made
130 end
131
132 it "should return information about an reopened issue" do
133 expect(@issue.project_id).to eq(3)
134 expect(@issue.assignee.name).to eq("Jack Smith")
135 end
136 end
137
138 describe ".subscribe_to_issue" do
139 before do
140 stub_post("/projects/3/issues/33/subscribe", "issue")
141 @issue = Gitlab.subscribe_to_issue(3, 33)
142 end
143
144 it "should get the correct resource" do
145 expect(a_post("/projects/3/issues/33/subscribe")).to have_been_made
146 end
147
148 it "should return information about the subscribed issue" do
149 expect(@issue.project_id).to eq(3)
150 expect(@issue.assignee.name).to eq("Jack Smith")
151 end
152 end
153
154 describe ".unsubscribe_from_issue" do
155 before do
156 stub_post("/projects/3/issues/33/unsubscribe", "issue")
157 @issue = Gitlab.unsubscribe_from_issue(3, 33)
158 end
159
160 it "should get the correct resource" do
161 expect(a_post("/projects/3/issues/33/unsubscribe")).to have_been_made
162 end
163
164 it "should return information about the unsubscribed issue" do
165 expect(@issue.project_id).to eq(3)
166 expect(@issue.assignee.name).to eq("Jack Smith")
167 end
168 end
169
170 describe ".delete_issue" do
171 before do
172 stub_delete("/projects/3/issues/33", "issue")
173 @issue = Gitlab.delete_issue(3, 33)
174 end
175
176 it "should get the correct resource" do
177 expect(a_delete("/projects/3/issues/33")).to have_been_made
178 end
179
180 it "should return information about a deleted issue" do
181 expect(@issue.project_id).to eq(3)
182 expect(@issue.id).to eq(33)
183 end
184 end
185 end
+0
-135
spec/gitlab/client/jobs_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe '.jobs' do
4 before do
5 stub_get('/projects/1/jobs', 'jobs')
6 @projects = Gitlab.jobs(1)
7 end
8
9 it 'should get the correct resource' do
10 expect(a_get('/projects/1/jobs')).to have_been_made
11 end
12 end
13
14 describe '.jobs - with scopes' do
15 before do
16 stub_get('/projects/1/jobs?scope[]=created&scope[]=running', 'jobs')
17 @projects = Gitlab.jobs(1, scope: %w[created running])
18 end
19
20 it 'should get the correct resource' do
21 expect(a_get('/projects/1/jobs?scope[]=created&scope[]=running')).to have_been_made
22 end
23 end
24
25 describe '.pipeline_jobs' do
26 before do
27 stub_get('/projects/1/pipelines/1/jobs', 'pipeline_jobs')
28 @projects = Gitlab.pipeline_jobs(1, 1)
29 end
30 it 'should get the correct resource' do
31 expect(a_get('/projects/1/pipelines/1/jobs')).to have_been_made
32 end
33 end
34
35 describe '.pipeline_jobs - with scope' do
36 before do
37 stub_get('/projects/1/pipelines/1/jobs?scope[]=running&scope[]=created', 'pipeline_jobs')
38 @projects = Gitlab.pipeline_jobs(1, 1, scope: %w[running created])
39 end
40 it 'should get the correct resource' do
41 expect(a_get('/projects/1/pipelines/1/jobs?scope[]=running&scope[]=created')).to have_been_made
42 end
43 end
44
45 describe '.job' do
46 before do
47 stub_get('/projects/1/jobs/1', 'job')
48 @projects = Gitlab.job(1, 1)
49 end
50 it 'should get the correct resource' do
51 expect(a_get('/projects/1/jobs/1')).to have_been_made
52 end
53 end
54
55 describe '.job_artifacts' do
56 before do
57 stub_get('/projects/1/jobs/1/artifacts', 'job')
58 @projects = Gitlab.job_artifacts(1, 1)
59 end
60 it 'should get the correct resource' do
61 expect(a_get('/projects/1/jobs/1/artifacts')).to have_been_made
62 end
63 end
64
65 describe '.job_artifacts_download' do
66 before do
67 stub_get('/projects/1/jobs/artifacts/master/download?job=Release%20Build', 'job')
68 @projects = Gitlab.job_artifacts_download(1, 'master', 'Release Build')
69 end
70 it 'should get the correct resource' do
71 expect(a_get('/projects/1/jobs/artifacts/master/download?job=Release%20Build')).to have_been_made
72 end
73 end
74
75 describe '.job_trace' do
76 before do
77 stub_get('/projects/1/jobs/1/trace', 'job_trace')
78 @projects = Gitlab.job_trace(1, 1)
79 end
80 it 'should get the correct resource' do
81 expect(a_get('/projects/1/jobs/1/trace')).to have_been_made
82 end
83 end
84
85 describe '.job_cancel' do
86 before do
87 stub_post('/projects/1/jobs/1/cancel', 'job')
88 @projects = Gitlab.job_cancel(1, 1)
89 end
90 it 'should get the correct resource' do
91 expect(a_post('/projects/1/jobs/1/cancel')).to have_been_made
92 end
93 end
94
95 describe '.job_retry' do
96 before do
97 stub_post('/projects/1/jobs/1/retry', 'job')
98 @projects = Gitlab.job_retry(1, 1)
99 end
100 it 'should get the correct resource' do
101 expect(a_post('/projects/1/jobs/1/retry')).to have_been_made
102 end
103 end
104
105 describe '.job_erase' do
106 before do
107 stub_post('/projects/1/jobs/1/erase', 'job')
108 @projects = Gitlab.job_erase(1, 1)
109 end
110 it 'should get the correct resource' do
111 expect(a_post('/projects/1/jobs/1/erase')).to have_been_made
112 end
113 end
114
115 describe '.job_play' do
116 before do
117 stub_post('/projects/1/jobs/1/play', 'job')
118 @projects = Gitlab.job_play(1, 1)
119 end
120 it 'should get the correct resource' do
121 expect(a_post('/projects/1/jobs/1/play')).to have_been_made
122 end
123 end
124
125 describe '.job_artifacts_keep' do
126 before do
127 stub_post('/projects/1/jobs/1/artifacts/keep', 'job')
128 @projects = Gitlab.job_artifacts_keep(1, 1)
129 end
130 it 'should get the correct resource' do
131 expect(a_post('/projects/1/jobs/1/artifacts/keep')).to have_been_made
132 end
133 end
134 end
+0
-19
spec/gitlab/client/keys_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".key" do
4 before do
5 stub_get("/keys/1", "key")
6 @key = Gitlab.key(1)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/keys/1")).to have_been_made
11 end
12
13 it "should return information about a key" do
14 expect(@key.id).to eq(1)
15 expect(@key.title).to eq("narkoz@helium")
16 end
17 end
18 end
+0
-100
spec/gitlab/client/labels_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".labels" do
4 before do
5 stub_get("/projects/3/labels", "labels")
6 @labels = Gitlab.labels(3)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/labels")).to have_been_made
11 end
12
13 it "should return a paginated response of project's labels" do
14 expect(@labels).to be_a Gitlab::PaginatedResponse
15 expect(@labels.first.name).to eq("Backlog")
16 end
17 end
18
19 describe ".delete" do
20 before do
21 stub_delete("/projects/3/labels", "label")
22 @label = Gitlab.delete_label(3, "Backlog")
23 end
24
25 it "should get the correct resource" do
26 expect(a_delete("/projects/3/labels").
27 with(body: { name: 'Backlog' })).to have_been_made
28 end
29
30 it "should return information about a deleted snippet" do
31 expect(@label.name).to eq("Backlog")
32 end
33 end
34
35 describe ".edit_label" do
36 before do
37 stub_put("/projects/3/labels", "label")
38 @label = Gitlab.edit_label(3, "TODO", new_name: 'Backlog')
39 end
40
41 it "should get the correct resource" do
42 expect(a_put("/projects/3/labels").
43 with(body: { name: 'TODO', new_name: "Backlog" })).to have_been_made
44 end
45
46 it "should return information about an edited label" do
47 expect(@label.name).to eq("Backlog")
48 end
49 end
50
51 describe ".create_label" do
52 before do
53 stub_post("/projects/3/labels", "label")
54 @label = Gitlab.create_label(3, 'Backlog', '#DD10AA')
55 end
56
57 it "should get the correct resource" do
58 expect(a_post("/projects/3/labels").
59 with(body: { name: 'Backlog', color: '#DD10AA' })).to have_been_made
60 end
61
62 it "should return information about a created label" do
63 expect(@label.name).to eq('Backlog')
64 expect(@label.color).to eq('#DD10AA')
65 end
66 end
67
68 describe ".subscribe_to_label" do
69 before do
70 stub_post("/projects/3/labels/Backlog/subscribe", "label")
71 @label = Gitlab.subscribe_to_label(3, 'Backlog')
72 end
73
74 it "should get the correct resource" do
75 expect(a_post("/projects/3/labels/Backlog/subscribe")).to have_been_made
76 end
77
78 it "should return information about the label subscribed to" do
79 expect(@label.name).to eq('Backlog')
80 expect(@label.subscribed).to eq(true)
81 end
82 end
83
84 describe ".unsubscribe_from_label" do
85 before do
86 stub_post("/projects/3/labels/Backlog/unsubscribe", "label_unsubscribe")
87 @label = Gitlab.unsubscribe_from_label(3, 'Backlog')
88 end
89
90 it "should get the correct resource" do
91 expect(a_post("/projects/3/labels/Backlog/unsubscribe")).to have_been_made
92 end
93
94 it "should return information about the label subscribed to" do
95 expect(@label.name).to eq('Backlog')
96 expect(@label.subscribed).to eq(false)
97 end
98 end
99 end
+0
-224
spec/gitlab/client/merge_requests_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".merge_requests" do
4 before do
5 stub_get("/projects/3/merge_requests", "merge_requests")
6 @merge_requests = Gitlab.merge_requests(3)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/merge_requests")).to have_been_made
11 end
12
13 it "should return a paginated response of project's merge requests" do
14 expect(@merge_requests).to be_a Gitlab::PaginatedResponse
15 expect(@merge_requests.first.project_id).to eq(3)
16 end
17 end
18
19 describe ".merge_request" do
20 before do
21 stub_get("/projects/3/merge_requests/1", "merge_request")
22 @merge_request = Gitlab.merge_request(3, 1)
23 end
24
25 it "should get the correct resource" do
26 expect(a_get("/projects/3/merge_requests/1")).to have_been_made
27 end
28
29 it "should return information about a merge request" do
30 expect(@merge_request.project_id).to eq(3)
31 expect(@merge_request.assignee.name).to eq("Jack Smith")
32 end
33 end
34
35 describe ".create_merge_request" do
36 before do
37 stub_post("/projects/3/merge_requests", "merge_request")
38 end
39
40 it "should return information about a merge request" do
41 @merge_request = Gitlab.create_merge_request(3, 'New feature',
42 source_branch: 'api',
43 target_branch: 'master'
44 )
45 expect(@merge_request.project_id).to eq(3)
46 expect(@merge_request.assignee.name).to eq("Jack Smith")
47 end
48 end
49
50 describe ".update_merge_request" do
51 before do
52 stub_put("/projects/3/merge_requests/2", "merge_request").
53 with(body: {
54 assignee_id: '1',
55 target_branch: 'master',
56 title: 'A different new feature'
57 })
58 @merge_request = Gitlab.update_merge_request(3, 2,
59 assignee_id: '1',
60 target_branch: 'master',
61 title: 'A different new feature'
62 )
63 end
64
65 it "should get the correct resource" do
66 expect(a_put("/projects/3/merge_requests/2").
67 with(body: {
68 assignee_id: '1',
69 target_branch: 'master',
70 title: 'A different new feature'
71 })).to have_been_made
72 end
73
74 it "should return information about a merge request" do
75 expect(@merge_request.project_id).to eq(3)
76 expect(@merge_request.assignee.name).to eq("Jack Smith")
77 end
78 end
79
80 describe ".accept_merge_request" do
81 before do
82 stub_put("/projects/5/merge_requests/42/merge", "merge_request").
83 with(body: { merge_commit_message: 'Nice!' })
84 @merge_request = Gitlab.accept_merge_request(5, 42, merge_commit_message: 'Nice!')
85 end
86
87 it "should get the correct resource" do
88 expect(a_put("/projects/5/merge_requests/42/merge").
89 with(body: { merge_commit_message: 'Nice!' })).to have_been_made
90 end
91
92 it "should return information about merged merge request" do
93 expect(@merge_request.project_id).to eq(3)
94 expect(@merge_request.assignee.name).to eq("Jack Smith")
95 end
96 end
97
98 describe ".merge_request_comments" do
99 before do
100 stub_get("/projects/3/merge_requests/2/notes", "merge_request_comments")
101 @merge_request = Gitlab.merge_request_comments(3, 2)
102 end
103
104 it "should get the correct resource" do
105 expect(a_get("/projects/3/merge_requests/2/notes")).to have_been_made
106 end
107
108 it "should return merge request's comments" do
109 expect(@merge_request).to be_an Gitlab::PaginatedResponse
110 expect(@merge_request.length).to eq(2)
111 expect(@merge_request[0].note).to eq("this is the 1st comment on the 2merge merge request")
112 expect(@merge_request[0].author.id).to eq(11)
113 expect(@merge_request[1].note).to eq("another discussion point on the 2merge request")
114 expect(@merge_request[1].author.id).to eq(12)
115 end
116 end
117
118 describe ".create_merge_request_comment" do
119 before do
120 stub_post("/projects/3/merge_requests/2/notes", "merge_request_comment")
121 @merge_request = Gitlab.create_merge_request_comment(3, 2, 'Cool Merge Request!')
122 end
123
124 it "should get the correct resource" do
125 expect(a_post("/projects/3/merge_requests/2/notes")).to have_been_made
126 end
127
128 it "should return information about a merge request" do
129 expect(@merge_request.note).to eq('Cool Merge Request!')
130 expect(@merge_request.author.id).to eq(1)
131 end
132 end
133
134 describe ".merge_request_changes" do
135 before do
136 stub_get("/projects/3/merge_requests/2/changes", "merge_request_changes")
137 @mr_changes = Gitlab.merge_request_changes(3, 2)
138 end
139
140 it "should get the correct resource" do
141 expect(a_get("/projects/3/merge_requests/2/changes")).to have_been_made
142 end
143
144 it "should return the merge request changes" do
145 expect(@mr_changes.changes).to be_a Array
146 expect(@mr_changes.changes.first['old_path']).to eq('lib/omniauth/builder.rb')
147 expect(@mr_changes.id).to eq(2)
148 expect(@mr_changes.project_id).to eq(3)
149 expect(@mr_changes.source_branch).to eq('uncovered')
150 expect(@mr_changes.target_branch).to eq('master')
151 end
152 end
153
154 describe ".merge_request_commits" do
155 before do
156 stub_get("/projects/3/merge_requests/2/commits", "merge_request_commits")
157 @mr_commits = Gitlab.merge_request_commits(3, 2)
158 end
159
160 it "should get the correct resource" do
161 expect(a_get("/projects/3/merge_requests/2/commits")).to have_been_made
162 end
163
164 it "should return the merge request commits" do
165 expect(@mr_commits).to be_a Gitlab::PaginatedResponse
166 expect(@mr_commits.size).to eq 2
167 expect(@mr_commits.first.id).to eq "a2da7552f26d5b46a6a09bb8b7b066e3a102be7d"
168 expect(@mr_commits.first.short_id).to eq "a2da7552"
169 expect(@mr_commits.first.title).to eq "piyo"
170 expect(@mr_commits.first.author_name).to eq "example"
171 expect(@mr_commits.first.author_email).to eq "example@example.com"
172 expect(@mr_commits[1].short_id).to eq "3ce50959"
173 expect(@mr_commits[1].title).to eq "hoge"
174 end
175 end
176
177 describe ".merge_request_closes_issues" do
178 before do
179 stub_get("/projects/5/merge_requests/1/closes_issues", "merge_request_closes_issues")
180 @issues = Gitlab.merge_request_closes_issues(5, 1)
181 end
182
183 it "should get the correct resource" do
184 expect(a_get("/projects/5/merge_requests/1/closes_issues")).to have_been_made
185 end
186
187 it "should return a paginated response of the issues the merge_request will close" do
188 expect(@issues).to be_a(Gitlab::PaginatedResponse)
189 expect(@issues.first.title).to eq("Merge request 1 issue 1")
190 expect(@issues.size).to eq(2)
191 end
192 end
193
194 describe ".subscribe_to_merge_request" do
195 before do
196 stub_post("/projects/3/merge_requests/2/subscribe", "merge_request")
197 @merge_request = Gitlab.subscribe_to_merge_request(3, 2)
198 end
199
200 it "should get the correct resource" do
201 expect(a_post("/projects/3/merge_requests/2/subscribe")).to have_been_made
202 end
203
204 it "should return information about a merge request" do
205 expect(@merge_request.project_id).to eq(3)
206 end
207 end
208
209 describe ".unsubscribe_from_merge_request" do
210 before do
211 stub_post("/projects/3/merge_requests/2/unsubscribe", "merge_request")
212 @merge_request = Gitlab.unsubscribe_from_merge_request(3, 2)
213 end
214
215 it "should get the correct resource" do
216 expect(a_post("/projects/3/merge_requests/2/unsubscribe")).to have_been_made
217 end
218
219 it "should return information about a merge request" do
220 expect(@merge_request.project_id).to eq(3)
221 end
222 end
223 end
+0
-98
spec/gitlab/client/milestones_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".milestones" do
4 before do
5 stub_get("/projects/3/milestones", "milestones")
6 @milestones = Gitlab.milestones(3)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/milestones")).to have_been_made
11 end
12
13 it "should return a paginated response of project's milestones" do
14 expect(@milestones).to be_a Gitlab::PaginatedResponse
15 expect(@milestones.first.project_id).to eq(3)
16 end
17 end
18
19 describe ".milestone" do
20 before do
21 stub_get("/projects/3/milestones/1", "milestone")
22 @milestone = Gitlab.milestone(3, 1)
23 end
24
25 it "should get the correct resource" do
26 expect(a_get("/projects/3/milestones/1")).to have_been_made
27 end
28
29 it "should return information about a milestone" do
30 expect(@milestone.project_id).to eq(3)
31 end
32 end
33
34 describe ".milestone_issues" do
35 before do
36 stub_get("/projects/3/milestones/1/issues", "milestone_issues")
37 @milestone_issues = Gitlab.milestone_issues(3, 1)
38 end
39
40 it "should get the correct resource" do
41 expect(a_get("/projects/3/milestones/1/issues")).to have_been_made
42 end
43
44 it "should return a paginated response of milestone's issues" do
45 expect(@milestone_issues).to be_a Gitlab::PaginatedResponse
46 expect(@milestone_issues.first.milestone.id).to eq(1)
47 end
48 end
49
50 describe ".milestone_merge_requests" do
51 before do
52 stub_get("/projects/3/milestones/1/merge_requests", "milestone_merge_requests")
53 @milestone_merge_requests = Gitlab.milestone_merge_requests(3, 1)
54 end
55
56 it "should get the correct resource" do
57 expect(a_get("/projects/3/milestones/1/merge_requests")).to have_been_made
58 end
59
60 it "should return a paginated response of milestone's merge_requests" do
61 expect(@milestone_merge_requests).to be_a Gitlab::PaginatedResponse
62 expect(@milestone_merge_requests.first.milestone.id).to eq(1)
63 end
64 end
65
66 describe ".create_milestone" do
67 before do
68 stub_post("/projects/3/milestones", "milestone")
69 @milestone = Gitlab.create_milestone(3, 'title')
70 end
71
72 it "should get the correct resource" do
73 expect(a_post("/projects/3/milestones").
74 with(body: { title: 'title' })).to have_been_made
75 end
76
77 it "should return information about a created milestone" do
78 expect(@milestone.project_id).to eq(3)
79 end
80 end
81
82 describe ".edit_milestone" do
83 before do
84 stub_put("/projects/3/milestones/33", "milestone")
85 @milestone = Gitlab.edit_milestone(3, 33, title: 'title')
86 end
87
88 it "should get the correct resource" do
89 expect(a_put("/projects/3/milestones/33").
90 with(body: { title: 'title' })).to have_been_made
91 end
92
93 it "should return information about an edited milestone" do
94 expect(@milestone.project_id).to eq(3)
95 end
96 end
97 end
+0
-22
spec/gitlab/client/namespaces_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 it { should respond_to :namespaces }
4
5 describe ".namespaces" do
6 before do
7 stub_get("/namespaces", "namespaces")
8 @namespaces = Gitlab.namespaces
9 end
10
11 it "should get the correct resource" do
12 expect(a_get("/namespaces")).to have_been_made
13 end
14
15 it "should return a paginated response of namespaces" do
16 expect(@namespaces).to be_a Gitlab::PaginatedResponse
17 expect(@namespaces.first.path).to eq("john")
18 expect(@namespaces.first.kind).to eq("user")
19 end
20 end
21 end
+0
-333
spec/gitlab/client/notes_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe "notes" do
4 context "when wall notes" do
5 before do
6 stub_get("/projects/3/notes", "notes")
7 @notes = Gitlab.notes(3)
8 end
9
10 it "should get the correct resource" do
11 expect(a_get("/projects/3/notes")).to have_been_made
12 end
13
14 it "should return a paginated response of notes" do
15 expect(@notes).to be_a Gitlab::PaginatedResponse
16 expect(@notes.first.author.name).to eq("John Smith")
17 end
18 end
19
20 context "when issue notes" do
21 before do
22 stub_get("/projects/3/issues/7/notes", "notes")
23 @notes = Gitlab.issue_notes(3, 7)
24 end
25
26 it "should get the correct resource" do
27 expect(a_get("/projects/3/issues/7/notes")).to have_been_made
28 end
29
30 it "should return a paginated response of notes" do
31 expect(@notes).to be_a Gitlab::PaginatedResponse
32 expect(@notes.first.author.name).to eq("John Smith")
33 end
34 end
35
36 context "when snippet notes" do
37 before do
38 stub_get("/projects/3/snippets/7/notes", "notes")
39 @notes = Gitlab.snippet_notes(3, 7)
40 end
41
42 it "should get the correct resource" do
43 expect(a_get("/projects/3/snippets/7/notes")).to have_been_made
44 end
45
46 it "should return a paginated response of notes" do
47 expect(@notes).to be_a Gitlab::PaginatedResponse
48 expect(@notes.first.author.name).to eq("John Smith")
49 end
50 end
51
52 context "when merge_request notes" do
53 before do
54 stub_get("/projects/3/merge_requests/7/notes", "notes")
55 @notes = Gitlab.merge_request_notes(3, 7)
56 end
57
58 it "should get the correct resource" do
59 expect(a_get("/projects/3/merge_requests/7/notes")).to have_been_made
60 end
61
62 it "should return a paginated response of notes" do
63 expect(@notes).to be_a Gitlab::PaginatedResponse
64 expect(@notes.first.author.name).to eq("John Smith")
65 end
66 end
67 end
68
69 describe "note" do
70 context "when wall note" do
71 before do
72 stub_get("/projects/3/notes/1201", "note")
73 @note = Gitlab.note(3, 1201)
74 end
75
76 it "should get the correct resource" do
77 expect(a_get("/projects/3/notes/1201")).to have_been_made
78 end
79
80 it "should return information about a note" do
81 expect(@note.body).to eq("The solution is rather tricky")
82 expect(@note.author.name).to eq("John Smith")
83 end
84 end
85
86 context "when issue note" do
87 before do
88 stub_get("/projects/3/issues/7/notes/1201", "note")
89 @note = Gitlab.issue_note(3, 7, 1201)
90 end
91
92 it "should get the correct resource" do
93 expect(a_get("/projects/3/issues/7/notes/1201")).to have_been_made
94 end
95
96 it "should return information about a note" do
97 expect(@note.body).to eq("The solution is rather tricky")
98 expect(@note.author.name).to eq("John Smith")
99 end
100 end
101
102 context "when snippet note" do
103 before do
104 stub_get("/projects/3/snippets/7/notes/1201", "note")
105 @note = Gitlab.snippet_note(3, 7, 1201)
106 end
107
108 it "should get the correct resource" do
109 expect(a_get("/projects/3/snippets/7/notes/1201")).to have_been_made
110 end
111
112 it "should return information about a note" do
113 expect(@note.body).to eq("The solution is rather tricky")
114 expect(@note.author.name).to eq("John Smith")
115 end
116 end
117
118 context "when merge request note" do
119 before do
120 stub_get("/projects/3/merge_requests/7/notes/1201", "note")
121 @note = Gitlab.merge_request_note(3, 7, 1201)
122 end
123
124 it "should get the correct resource" do
125 expect(a_get("/projects/3/merge_requests/7/notes/1201")).to have_been_made
126 end
127
128 it "should return information about a note" do
129 expect(@note.body).to eq("The solution is rather tricky")
130 expect(@note.author.name).to eq("John Smith")
131 end
132 end
133 end
134
135 describe "create note" do
136 context "when wall note" do
137 before do
138 stub_post("/projects/3/notes", "note")
139 @note = Gitlab.create_note(3, "The solution is rather tricky")
140 end
141
142 it "should get the correct resource" do
143 expect(a_post("/projects/3/notes").
144 with(body: { body: 'The solution is rather tricky' })).to have_been_made
145 end
146
147 it "should return information about a created note" do
148 expect(@note.body).to eq("The solution is rather tricky")
149 expect(@note.author.name).to eq("John Smith")
150 end
151 end
152
153 context "when issue note" do
154 before do
155 stub_post("/projects/3/issues/7/notes", "note")
156 @note = Gitlab.create_issue_note(3, 7, "The solution is rather tricky")
157 end
158
159 it "should get the correct resource" do
160 expect(a_post("/projects/3/issues/7/notes").
161 with(body: { body: 'The solution is rather tricky' })).to have_been_made
162 end
163
164 it "should return information about a created note" do
165 expect(@note.body).to eq("The solution is rather tricky")
166 expect(@note.author.name).to eq("John Smith")
167 end
168 end
169
170 context "when snippet note" do
171 before do
172 stub_post("/projects/3/snippets/7/notes", "note")
173 @note = Gitlab.create_snippet_note(3, 7, "The solution is rather tricky")
174 end
175
176 it "should get the correct resource" do
177 expect(a_post("/projects/3/snippets/7/notes").
178 with(body: { body: 'The solution is rather tricky' })).to have_been_made
179 end
180
181 it "should return information about a created note" do
182 expect(@note.body).to eq("The solution is rather tricky")
183 expect(@note.author.name).to eq("John Smith")
184 end
185 end
186
187 context "when merge_request note" do
188 before do
189 stub_post("/projects/3/merge_requests/7/notes", "note")
190 @note = Gitlab.create_merge_request_note(3, 7, "The solution is rather tricky")
191 end
192
193 it "should get the correct resource" do
194 expect(a_post("/projects/3/merge_requests/7/notes").
195 with(body: { body: 'The solution is rather tricky' })).to have_been_made
196 end
197
198 it "should return information about a created note" do
199 expect(@note.body).to eq("The solution is rather tricky")
200 expect(@note.author.name).to eq("John Smith")
201 end
202 end
203 end
204
205 describe "delete note" do
206 context "when wall note" do
207 before do
208 stub_delete("/projects/3/notes/1201", "note")
209 @note = Gitlab.delete_note(3, 1201)
210 end
211
212 it "should get the correct resource" do
213 expect(a_delete("/projects/3/notes/1201")).to have_been_made
214 end
215
216 it "should return information about a deleted note" do
217 expect(@note.id).to eq(1201)
218 end
219 end
220
221 context "when issue note" do
222 before do
223 stub_delete("/projects/3/issues/7/notes/1201", "note")
224 @note = Gitlab.delete_issue_note(3, 7, 1201)
225 end
226
227 it "should get the correct resource" do
228 expect(a_delete("/projects/3/issues/7/notes/1201")).to have_been_made
229 end
230
231 it "should return information about a deleted issue note" do
232 expect(@note.id).to eq(1201)
233 end
234 end
235
236 context "when snippet note" do
237 before do
238 stub_delete("/projects/3/snippets/7/notes/1201", "note")
239 @note = Gitlab.delete_snippet_note(3, 7, 1201)
240 end
241
242 it "should get the correct resource" do
243 expect(a_delete("/projects/3/snippets/7/notes/1201")).to have_been_made
244 end
245
246 it "should return information about a deleted snippet note" do
247 expect(@note.id).to eq(1201)
248 end
249 end
250
251 context "when merge request note" do
252 before do
253 stub_delete("/projects/3/merge_requests/7/notes/1201", "note")
254 @note = Gitlab.delete_merge_request_note(3, 7, 1201)
255 end
256
257 it "should get the correct resource" do
258 expect(a_delete("/projects/3/merge_requests/7/notes/1201")).to have_been_made
259 end
260
261 it "should return information about a deleted merge request note" do
262 expect(@note.id).to eq(1201)
263 end
264 end
265 end
266
267 describe "modify note" do
268 context "when wall note" do
269 before do
270 stub_put("/projects/3/notes/1201", "note")
271 @note = Gitlab.edit_note(3, 1201, body: "edited wall note content")
272 end
273
274 it "should get the correct resource" do
275 expect(a_put("/projects/3/notes/1201").
276 with(body: {body: 'edited wall note content'})).to have_been_made
277 end
278
279 it "should return information about a modified note" do
280 expect(@note.id).to eq(1201)
281 end
282 end
283
284 context "when issue note" do
285 before do
286 stub_put("/projects/3/issues/7/notes/1201", "note")
287 @note = Gitlab.edit_issue_note(3, 7, 1201, body: "edited issue note content")
288 end
289
290 it "should get the correct resource" do
291 expect(a_put("/projects/3/issues/7/notes/1201").
292 with(body: {body: 'edited issue note content'})).to have_been_made
293 end
294
295 it "should return information about a modified issue note" do
296 expect(@note.id).to eq(1201)
297 end
298 end
299
300 context "when snippet note" do
301 before do
302 stub_put("/projects/3/snippets/7/notes/1201", "note")
303 @note = Gitlab.edit_snippet_note(3, 7, 1201, body: "edited snippet note content")
304 end
305
306 it "should get the correct resource" do
307 expect(a_put("/projects/3/snippets/7/notes/1201").
308 with(body: {body: 'edited snippet note content'})).to have_been_made
309 end
310
311 it "should return information about a modified snippet note" do
312 expect(@note.id).to eq(1201)
313 end
314 end
315
316 context "when merge request note" do
317 before do
318 stub_put("/projects/3/merge_requests/7/notes/1201", "note")
319 @note = Gitlab.edit_merge_request_note(3, 7, 1201, body: "edited merge request note content")
320 end
321
322 it "should get the correct resource" do
323 expect(a_put("/projects/3/merge_requests/7/notes/1201").
324 with(body: {body: 'edited merge request note content'})).to have_been_made
325 end
326
327 it "should return information about a modified request note" do
328 expect(@note.id).to eq(1201)
329 end
330 end
331 end
332 end
+0
-157
spec/gitlab/client/pipeline_triggers_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 it { should respond_to :delete_trigger }
4
5 describe ".triggers" do
6 before do
7 stub_get("/projects/3/triggers", "triggers")
8 @triggers = Gitlab.triggers(3)
9 end
10
11 it "should get the correct resource" do
12 expect(a_get("/projects/3/triggers")).to have_been_made
13 end
14
15 it "should return an array of project's triggers" do
16 expect(@triggers).to be_a Gitlab::PaginatedResponse
17 expect(@triggers.first.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7")
18 end
19 end
20
21 describe ".trigger" do
22 before do
23 stub_get("/projects/3/triggers/10", "trigger")
24 @trigger = Gitlab.trigger(3, 10)
25 end
26
27 it "should get the correct resource" do
28 expect(a_get("/projects/3/triggers/10")).to have_been_made
29 end
30
31 it "should return information about a trigger" do
32 expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z")
33 expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7")
34 end
35 end
36
37 describe ".create_trigger" do
38 before do
39 stub_post("/projects/3/triggers", "trigger")
40 @trigger = Gitlab.create_trigger(3, "my description")
41 end
42
43 it "should get the correct resource" do
44 expect(a_post("/projects/3/triggers").
45 with(body: { description: "my description" })).to have_been_made
46 end
47
48 it "should return information about a new trigger" do
49 expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z")
50 expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7")
51 end
52 end
53
54 describe ".update_trigger" do
55 before do
56 stub_put("/projects/3/triggers/1", "trigger")
57 @trigger = Gitlab.update_trigger(3, 1, description: "my description")
58 end
59
60 it "should get the correct resource" do
61 expect(a_put("/projects/3/triggers/1").
62 with(body: { description: "my description" })).to have_been_made
63 end
64
65 it "should return information about the trigger" do
66 expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z")
67 expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7")
68 end
69 end
70
71 describe ".trigger_take_ownership" do
72 before do
73 stub_post("/projects/3/triggers/1/take_ownership", "trigger")
74 @trigger = Gitlab.trigger_take_ownership(3, 1)
75 end
76
77 it "should get the correct resource" do
78 expect(a_post("/projects/3/triggers/1/take_ownership")).to have_been_made
79 end
80
81 it "should return information about the trigger" do
82 expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z")
83 expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7")
84 end
85 end
86
87 describe ".remove_trigger" do
88 before do
89 stub_delete("/projects/3/triggers/10", "empty")
90 @trigger = Gitlab.remove_trigger(3, 10)
91 end
92
93 it "should get the correct resource" do
94 expect(a_delete("/projects/3/triggers/10")).to have_been_made
95 end
96 end
97
98 describe ".run_trigger" do
99 before do
100 stub_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline").
101 to_return(body: load_fixture("run_trigger"), status: 200)
102 end
103
104 context "when private_token is not set" do
105 before do
106 Gitlab.private_token = nil
107 end
108
109 it "should not raise Error::MissingCredentials" do
110 expect { Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master", {a: 10}) }.to_not raise_error
111 end
112
113 after do
114 Gitlab.private_token = 'secret'
115 end
116 end
117
118 context "without variables" do
119 before do
120 @trigger = Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master")
121 end
122
123 it "should get the correct resource" do
124 expect(a_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline").
125 with(body: {
126 token: "7b9148c158980bbd9bcea92c17522d",
127 ref: "master"
128 })).to have_been_made
129 end
130
131 it "should return information about the triggered build" do
132 expect(@trigger.id).to eq(8)
133 end
134 end
135
136 context "with variables" do
137 before do
138 @trigger = Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master", {a: 10})
139 end
140
141 it "should get the correct resource" do
142 expect(a_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline").
143 with(body: {
144 token: "7b9148c158980bbd9bcea92c17522d",
145 ref: "master",
146 variables: {a: "10"}
147 })).to have_been_made
148 end
149
150 it "should return information about the triggered build" do
151 expect(@trigger.id).to eq(8)
152 expect(@trigger.variables.a).to eq("10")
153 end
154 end
155 end
156 end
+0
-95
spec/gitlab/client/pipelines_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".pipelines" do
4 before do
5 stub_get("/projects/3/pipelines", "pipelines")
6 @pipelines = Gitlab.pipelines(3)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/pipelines")).to have_been_made
11 end
12
13 it "should return a paginated response of project's pipelines" do
14 expect(@pipelines).to be_a Gitlab::PaginatedResponse
15 end
16 end
17
18 describe ".pipeline" do
19 before do
20 stub_get("/projects/3/pipelines/46", "pipeline")
21 @pipeline = Gitlab.pipeline(3, 46)
22 end
23
24 it "should get the correct resource" do
25 expect(a_get("/projects/3/pipelines/46")).to have_been_made
26 end
27
28 it "should return a single pipeline" do
29 expect(@pipeline).to be_a Gitlab::ObjectifiedHash
30 end
31
32 it "should return information about a pipeline" do
33 expect(@pipeline.id).to eq(46)
34 expect(@pipeline.user.name).to eq("Administrator")
35 end
36 end
37
38 describe ".create_pipeline" do
39 before do
40 stub_post("/projects/3/pipeline?ref=master", "pipeline_create")
41 @pipeline_create = Gitlab.create_pipeline(3, 'master')
42 end
43
44 it "should get the correct resource" do
45 expect(a_post("/projects/3/pipeline?ref=master")).to have_been_made
46 end
47
48 it "should return a single pipeline" do
49 expect(@pipeline_create).to be_a Gitlab::ObjectifiedHash
50 end
51
52 it "should return information about a pipeline" do
53 expect(@pipeline_create.user.name).to eq("Administrator")
54 end
55 end
56
57 describe ".cancel_pipeline" do
58 before do
59 stub_post("/projects/3/pipelines/46/cancel", "pipeline_cancel")
60 @pipeline_cancel = Gitlab.cancel_pipeline(3, 46)
61 end
62
63 it "should get the correct resource" do
64 expect(a_post("/projects/3/pipelines/46/cancel")).to have_been_made
65 end
66
67 it "should return a single pipeline" do
68 expect(@pipeline_cancel).to be_a Gitlab::ObjectifiedHash
69 end
70
71 it "should return information about a pipeline" do
72 expect(@pipeline_cancel.user.name).to eq("Administrator")
73 end
74 end
75
76 describe ".retry_pipeline" do
77 before do
78 stub_post("/projects/3/pipelines/46/retry", "pipeline_retry")
79 @pipeline_retry = Gitlab.retry_pipeline(3, 46)
80 end
81
82 it "should get the correct resource" do
83 expect(a_post("/projects/3/pipelines/46/retry")).to have_been_made
84 end
85
86 it "should return a single pipeline" do
87 expect(@pipeline_retry).to be_a Gitlab::ObjectifiedHash
88 end
89
90 it "should return information about a pipeline" do
91 expect(@pipeline_retry.user.name).to eq("Administrator")
92 end
93 end
94 end
+0
-613
spec/gitlab/client/projects_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 it { should respond_to :search_projects }
4
5 describe ".projects" do
6 before do
7 stub_get("/projects", "projects")
8 @projects = Gitlab.projects
9 end
10
11 it "should get the correct resource" do
12 expect(a_get("/projects")).to have_been_made
13 end
14
15 it "should return a paginated response of projects" do
16 expect(@projects).to be_a Gitlab::PaginatedResponse
17 expect(@projects.first.name).to eq("Brute")
18 expect(@projects.first.owner.name).to eq("John Smith")
19 end
20 end
21
22 describe ".project_search" do
23 before do
24 stub_get("/projects?search=Gitlab", "project_search")
25 @project_search = Gitlab.project_search("Gitlab")
26 end
27
28 it "should get the correct resource" do
29 expect(a_get("/projects?search=Gitlab")).to have_been_made
30 end
31
32 it "should return a paginated response of projects found" do
33 expect(@project_search).to be_a Gitlab::PaginatedResponse
34 expect(@project_search.first.name).to eq("Gitlab")
35 expect(@project_search.first.owner.name).to eq("John Smith")
36 end
37 end
38
39 describe ".project" do
40 before do
41 stub_get("/projects/3", "project")
42 @project = Gitlab.project(3)
43 end
44
45 it "should get the correct resource" do
46 expect(a_get("/projects/3")).to have_been_made
47 end
48
49 it "should return information about a project" do
50 expect(@project.name).to eq("Gitlab")
51 expect(@project.owner.name).to eq("John Smith")
52 end
53 end
54
55 describe ".project_events" do
56 before do
57 stub_get("/projects/2/events", "project_events")
58 @events = Gitlab.project_events(2)
59 end
60
61 it "should get the correct resource" do
62 expect(a_get("/projects/2/events")).to have_been_made
63 end
64
65 it "should return a paginated response of events" do
66 expect(@events).to be_a Gitlab::PaginatedResponse
67 expect(@events.size).to eq(2)
68 end
69
70 it "should return the action name of the event" do
71 expect(@events.first.action_name).to eq("opened")
72 end
73 end
74
75 describe ".create_project" do
76 before do
77 stub_post("/projects", "project")
78 @project = Gitlab.create_project('Gitlab')
79 end
80
81 it "should get the correct resource" do
82 expect(a_post("/projects")).to have_been_made
83 end
84
85 it "should return information about a created project" do
86 expect(@project.name).to eq("Gitlab")
87 expect(@project.owner.name).to eq("John Smith")
88 end
89 end
90
91 describe ".create_project for user" do
92 before do
93 stub_post("/users", "user")
94 @owner = Gitlab.create_user("john@example.com", "pass", name: 'John Owner')
95 stub_post("/projects/user/#{@owner.id}", "project_for_user")
96 @project = Gitlab.create_project('Brute', user_id: @owner.id)
97 end
98
99 it "should return information about a created project" do
100 expect(@project.name).to eq("Brute")
101 expect(@project.owner.name).to eq("John Owner")
102 end
103 end
104
105 describe ".delete_project" do
106 before do
107 stub_delete("/projects/Gitlab", "project")
108 @project = Gitlab.delete_project('Gitlab')
109 end
110
111 it "should get the correct resource" do
112 expect(a_delete("/projects/Gitlab")).to have_been_made
113 end
114
115 it "should return information about a deleted project" do
116 expect(@project.name).to eq("Gitlab")
117 expect(@project.owner.name).to eq("John Smith")
118 end
119 end
120
121 describe ".create_fork" do
122 context "without sudo option" do
123 before do
124 stub_post("/projects/3/fork", "project_fork")
125 @project = Gitlab.create_fork(3)
126 end
127
128 it "should post to the correct resource" do
129 expect(a_post("/projects/3/fork")).to have_been_made
130 end
131
132 it "should return information about the forked project" do
133 expect(@project.forked_from_project.id).to eq(3)
134 expect(@project.id).to eq(20)
135 end
136 end
137
138 context "with the sudo option" do
139 before do
140 stub_post("/projects/3/fork", "project_forked_for_user")
141 @sudoed_username = 'jack.smith'
142 @project = Gitlab.create_fork(3, sudo: @sudoed_username)
143 end
144
145 it "should post to the correct resource" do
146 expect(a_post("/projects/3/fork")).to have_been_made
147 end
148
149 it "should return information about the forked project" do
150 expect(@project.forked_from_project.id).to eq(3)
151 expect(@project.id).to eq(20)
152 expect(@project.owner.username).to eq(@sudoed_username)
153 end
154 end
155 end
156
157 describe ".team_members" do
158 before do
159 stub_get("/projects/3/members", "team_members")
160 @team_members = Gitlab.team_members(3)
161 end
162
163 it "should get the correct resource" do
164 expect(a_get("/projects/3/members")).to have_been_made
165 end
166
167 it "should return a paginated response of team members" do
168 expect(@team_members).to be_a Gitlab::PaginatedResponse
169 expect(@team_members.first.name).to eq("John Smith")
170 end
171 end
172
173 describe ".team_member" do
174 before do
175 stub_get("/projects/3/members/1", "team_member")
176 @team_member = Gitlab.team_member(3, 1)
177 end
178
179 it "should get the correct resource" do
180 expect(a_get("/projects/3/members/1")).to have_been_made
181 end
182
183 it "should return information about a team member" do
184 expect(@team_member.name).to eq("John Smith")
185 end
186 end
187
188 describe ".add_team_member" do
189 before do
190 stub_post("/projects/3/members", "team_member")
191 @team_member = Gitlab.add_team_member(3, 1, 40)
192 end
193
194 it "should get the correct resource" do
195 expect(a_post("/projects/3/members").
196 with(body: { user_id: '1', access_level: '40' })).to have_been_made
197 end
198
199 it "should return information about an added team member" do
200 expect(@team_member.name).to eq("John Smith")
201 end
202 end
203
204 describe ".edit_team_member" do
205 before do
206 stub_put("/projects/3/members/1", "team_member")
207 @team_member = Gitlab.edit_team_member(3, 1, 40)
208 end
209
210 it "should get the correct resource" do
211 expect(a_put("/projects/3/members/1").
212 with(body: { access_level: '40' })).to have_been_made
213 end
214
215 it "should return information about an edited team member" do
216 expect(@team_member.name).to eq("John Smith")
217 end
218 end
219
220 describe ".remove_team_member" do
221 before do
222 stub_delete("/projects/3/members/1", "team_member")
223 @team_member = Gitlab.remove_team_member(3, 1)
224 end
225
226 it "should get the correct resource" do
227 expect(a_delete("/projects/3/members/1")).to have_been_made
228 end
229
230 it "should return information about a removed team member" do
231 expect(@team_member.name).to eq("John Smith")
232 end
233 end
234
235 describe ".project_hooks" do
236 before do
237 stub_get("/projects/1/hooks", "project_hooks")
238 @hooks = Gitlab.project_hooks(1)
239 end
240
241 it "should get the correct resource" do
242 expect(a_get("/projects/1/hooks")).to have_been_made
243 end
244
245 it "should return a paginated response of hooks" do
246 expect(@hooks).to be_a Gitlab::PaginatedResponse
247 expect(@hooks.first.url).to eq("https://api.example.net/v1/webhooks/ci")
248 end
249 end
250
251 describe ".project_hook" do
252 before do
253 stub_get("/projects/1/hooks/1", "project_hook")
254 @hook = Gitlab.project_hook(1, 1)
255 end
256
257 it "should get the correct resource" do
258 expect(a_get("/projects/1/hooks/1")).to have_been_made
259 end
260
261 it "should return information about a hook" do
262 expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci")
263 end
264 end
265
266 describe ".add_project_hook" do
267 context "without specified events" do
268 before do
269 stub_post("/projects/1/hooks", "project_hook")
270 @hook = Gitlab.add_project_hook(1, "https://api.example.net/v1/webhooks/ci")
271 end
272
273 it "should get the correct resource" do
274 body = { url: "https://api.example.net/v1/webhooks/ci" }
275 expect(a_post("/projects/1/hooks").with(body: body)).to have_been_made
276 end
277
278 it "should return information about an added hook" do
279 expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci")
280 end
281 end
282
283 context "with specified events" do
284 before do
285 stub_post("/projects/1/hooks", "project_hook")
286 @hook = Gitlab.add_project_hook(1, "https://api.example.net/v1/webhooks/ci", push_events: true, merge_requests_events: true)
287 end
288
289 it "should get the correct resource" do
290 body = { url: "https://api.example.net/v1/webhooks/ci", push_events: "true", merge_requests_events: "true" }
291 expect(a_post("/projects/1/hooks").with(body: body)).to have_been_made
292 end
293
294 it "should return information about an added hook" do
295 expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci")
296 end
297 end
298 end
299
300 describe ".edit_project_hook" do
301 before do
302 stub_put("/projects/1/hooks/1", "project_hook")
303 @hook = Gitlab.edit_project_hook(1, 1, "https://api.example.net/v1/webhooks/ci")
304 end
305
306 it "should get the correct resource" do
307 body = { url: "https://api.example.net/v1/webhooks/ci" }
308 expect(a_put("/projects/1/hooks/1").with(body: body)).to have_been_made
309 end
310
311 it "should return information about an edited hook" do
312 expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci")
313 end
314 end
315
316 describe ".edit_project" do
317 context "using project ID" do
318 before do
319 stub_put("/projects/3", "project_edit").with(body: { name: "Gitlab-edit" })
320 @edited_project = Gitlab.edit_project(3, name: "Gitlab-edit")
321 end
322
323 it "should get the correct resource" do
324 expect(a_put("/projects/3").with(body: { name: "Gitlab-edit" })).to have_been_made
325 end
326
327 it "should return information about an edited project" do
328 expect(@edited_project.name).to eq("Gitlab-edit")
329 end
330 end
331
332 context "using namespaced project path" do
333 it "encodes the path properly" do
334 stub = stub_put("/projects/namespace%2Fpath", "project_edit").with(body: { name: "Gitlab-edit" })
335 Gitlab.edit_project('namespace/path', name: "Gitlab-edit")
336 expect(stub).to have_been_requested
337 end
338 end
339 end
340
341 describe ".delete_project_hook" do
342 context "when empty response" do
343 before do
344 stub_request(:delete, "#{Gitlab.endpoint}/projects/1/hooks/1").
345 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
346 to_return(body: '')
347 @hook = Gitlab.delete_project_hook(1, 1)
348 end
349
350 it "should get the correct resource" do
351 expect(a_delete("/projects/1/hooks/1")).to have_been_made
352 end
353
354 it "should return false" do
355 expect(@hook).to be(false)
356 end
357 end
358
359 context "when JSON response" do
360 before do
361 stub_delete("/projects/1/hooks/1", "project_hook")
362 @hook = Gitlab.delete_project_hook(1, 1)
363 end
364
365 it "should get the correct resource" do
366 expect(a_delete("/projects/1/hooks/1")).to have_been_made
367 end
368
369 it "should return information about a deleted hook" do
370 expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci")
371 end
372 end
373 end
374
375 describe ".push_rule" do
376 before do
377 stub_get("/projects/1/push_rule", "push_rule")
378 @push_rule = Gitlab.push_rule(1)
379 end
380
381 it "should get the correct resource" do
382 expect(a_get("/projects/1/push_rule")).to have_been_made
383 end
384
385 it "should return information about a push rule" do
386 expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
387 end
388 end
389
390 describe ".add_push_rule" do
391 before do
392 stub_post("/projects/1/push_rule", "push_rule")
393 @push_rule = Gitlab.add_push_rule(1, { deny_delete_tag: false, commit_message_regex: "\\b[A-Z]{3}-[0-9]+\\b" })
394 end
395
396 it "should get the correct resource" do
397 expect(a_post("/projects/1/push_rule")).to have_been_made
398 end
399
400 it "should return information about an added push rule" do
401 expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
402 end
403 end
404
405 describe ".edit_push_rule" do
406 before do
407 stub_put("/projects/1/push_rule", "push_rule")
408 @push_rule = Gitlab.edit_push_rule(1, { deny_delete_tag: false, commit_message_regex: "\\b[A-Z]{3}-[0-9]+\\b" })
409 end
410
411 it "should get the correct resource" do
412 expect(a_put("/projects/1/push_rule")).to have_been_made
413 end
414
415 it "should return information about an edited push rule" do
416 expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
417 end
418 end
419
420 describe ".delete_push_rule" do
421 context "when empty response" do
422 before do
423 stub_request(:delete, "#{Gitlab.endpoint}/projects/1/push_rule").
424 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
425 to_return(body: '')
426 @push_rule = Gitlab.delete_push_rule(1)
427 end
428
429 it "should get the correct resource" do
430 expect(a_delete("/projects/1/push_rule")).to have_been_made
431 end
432
433 it "should return false" do
434 expect(@push_rule).to be(false)
435 end
436 end
437
438 context "when JSON response" do
439 before do
440 stub_delete("/projects/1/push_rule", "push_rule")
441 @push_rule = Gitlab.delete_push_rule(1)
442 end
443
444 it "should get the correct resource" do
445 expect(a_delete("/projects/1/push_rule")).to have_been_made
446 end
447
448 it "should return information about a deleted push rule" do
449 expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
450 end
451 end
452 end
453
454 describe ".make_forked_from" do
455 before do
456 stub_post("/projects/42/fork/24", "project_fork_link")
457 @forked_project_link = Gitlab.make_forked_from(42, 24)
458 end
459
460 it "should get the correct resource" do
461 expect(a_post("/projects/42/fork/24")).to have_been_made
462 end
463
464 it "should return information about a forked project" do
465 expect(@forked_project_link.forked_from_project_id).to eq(24)
466 expect(@forked_project_link.forked_to_project_id).to eq(42)
467 end
468 end
469
470 describe ".remove_forked" do
471 before do
472 stub_delete("/projects/42/fork", "project_fork_link")
473 @forked_project_link = Gitlab.remove_forked(42)
474 end
475
476 it "should be sent to correct resource" do
477 expect(a_delete("/projects/42/fork")).to have_been_made
478 end
479
480 it "should return information about an unforked project" do
481 expect(@forked_project_link.forked_to_project_id).to eq(42)
482 end
483 end
484
485 describe ".deploy_keys" do
486 before do
487 stub_get("/projects/42/deploy_keys", "project_keys")
488 @deploy_keys = Gitlab.deploy_keys(42)
489 end
490
491 it "should get the correct resource" do
492 expect(a_get("/projects/42/deploy_keys")).to have_been_made
493 end
494
495 it "should return project deploy keys" do
496 expect(@deploy_keys).to be_a Gitlab::PaginatedResponse
497 expect(@deploy_keys.first.id).to eq 2
498 expect(@deploy_keys.first.title).to eq "Key Title"
499 expect(@deploy_keys.first.key).to match(/ssh-rsa/)
500 end
501 end
502
503 describe ".deploy_key" do
504 before do
505 stub_get("/projects/42/deploy_keys/2", "project_key")
506 @deploy_key = Gitlab.deploy_key(42, 2)
507 end
508
509 it "should get the correct resource" do
510 expect(a_get("/projects/42/deploy_keys/2")).to have_been_made
511 end
512
513 it "should return project deploy key" do
514 expect(@deploy_key.id).to eq 2
515 expect(@deploy_key.title).to eq "Key Title"
516 expect(@deploy_key.key).to match(/ssh-rsa/)
517 end
518 end
519
520 describe ".delete_deploy_key" do
521 before do
522 stub_delete("/projects/42/deploy_keys/2", "project_key")
523 @deploy_key = Gitlab.delete_deploy_key(42, 2)
524 end
525
526 it "should get the correct resource" do
527 expect(a_delete("/projects/42/deploy_keys/2")).to have_been_made
528 end
529
530 it "should return information about a deleted key" do
531 expect(@deploy_key.id).to eq(2)
532 end
533 end
534
535 describe ".enable_deploy_key" do
536 before do
537 stub_post("/projects/42/deploy_keys/2/enable", "project_key")
538 @deploy_key = Gitlab.enable_deploy_key(42, 2)
539 end
540
541 it "should get the correct resource" do
542 expect(a_post("/projects/42/deploy_keys/2/enable").
543 with(body: { id: '42', key_id: '2' })).to have_been_made
544 end
545
546 it "should return information about an enabled key" do
547 expect(@deploy_key.id).to eq(2)
548 end
549 end
550
551 describe ".disable_deploy_key" do
552 before do
553 stub_post("/projects/42/deploy_keys/2/disable", "project_key")
554 @deploy_key = Gitlab.disable_deploy_key(42, 2)
555 end
556
557 it "should get the correct resource" do
558 expect(a_post("/projects/42/deploy_keys/2/disable").
559 with(body: { id: '42', key_id: '2' })).to have_been_made
560 end
561
562 it "should return information about a disabled key" do
563 expect(@deploy_key.id).to eq(2)
564 end
565 end
566
567 describe ".share_project_with_group" do
568 before do
569 stub_post("/projects/3/share", "group")
570 @group = Gitlab.share_project_with_group(3, 10, 40)
571 end
572
573 it "should get the correct resource" do
574 expect(a_post("/projects/3/share").
575 with(body: { group_id: '10', group_access: '40' })).to have_been_made
576 end
577
578 it "should return information about an added group" do
579 expect(@group.id).to eq(10)
580 end
581 end
582
583 describe ".star_project" do
584 before do
585 stub_post("/projects/3/star", "project_star")
586 @starred_project = Gitlab.star_project(3)
587 end
588
589 it "should get the correct resource" do
590 expect(a_post("/projects/3/star")).to have_been_made
591 end
592
593 it "should return information about the starred project" do
594 expect(@starred_project.id).to eq(3)
595 end
596 end
597
598 describe ".unstar_project" do
599 before do
600 stub_delete("/projects/3/star", "project_unstar")
601 @unstarred_project = Gitlab.unstar_project(3)
602 end
603
604 it "should get the correct resource" do
605 expect(a_delete("/projects/3/star")).to have_been_made
606 end
607
608 it "should return information about the unstarred project" do
609 expect(@unstarred_project.id).to eq(3)
610 end
611 end
612 end
+0
-94
spec/gitlab/client/repositories_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 it { should respond_to :repo_tags }
4 it { should respond_to :repo_create_tag }
5 it { should respond_to :repo_branches }
6 it { should respond_to :repo_branch }
7 it { should respond_to :repo_tree }
8 it { should respond_to :repo_compare }
9
10 describe ".tags" do
11 before do
12 stub_get("/projects/3/repository/tags", "project_tags")
13 @tags = Gitlab.tags(3)
14 end
15
16 it "should get the correct resource" do
17 expect(a_get("/projects/3/repository/tags")).to have_been_made
18 end
19
20 it "should return a paginated response of repository tags" do
21 expect(@tags).to be_a Gitlab::PaginatedResponse
22 expect(@tags.first.name).to eq("v2.8.2")
23 end
24 end
25
26 describe ".create_tag" do
27 context "when lightweight" do
28 before do
29 stub_post("/projects/3/repository/tags", "project_tag_lightweight")
30 @tag = Gitlab.create_tag(3, 'v1.0.0', '2695effb5807a22ff3d138d593fd856244e155e7')
31 end
32
33 it "should get the correct resource" do
34 expect(a_post("/projects/3/repository/tags")).to have_been_made
35 end
36
37 it "should return information about a new repository tag" do
38 expect(@tag.name).to eq("v1.0.0")
39 expect(@tag.message).to eq(nil)
40 end
41 end
42
43 context "when annotated" do
44 before do
45 stub_post("/projects/3/repository/tags", "project_tag_annotated")
46 @tag = Gitlab.create_tag(3, 'v1.1.0', '2695effb5807a22ff3d138d593fd856244e155e7', 'Release 1.1.0')
47 end
48
49 it "should get the correct resource" do
50 expect(a_post("/projects/3/repository/tags")).to have_been_made
51 end
52
53 it "should return information about a new repository tag" do
54 expect(@tag.name).to eq("v1.1.0")
55 expect(@tag.message).to eq("Release 1.1.0")
56 end
57 end
58 end
59
60 describe ".tree" do
61 before do
62 stub_get("/projects/3/repository/tree", "tree")
63 @tree = Gitlab.tree(3)
64 end
65
66 it "should get the correct resource" do
67 expect(a_get("/projects/3/repository/tree")).to have_been_made
68 end
69
70 it "should return a paginated response of repository tree files (root level)" do
71 expect(@tree).to be_a Gitlab::PaginatedResponse
72 expect(@tree.first.name).to eq("app")
73 end
74 end
75
76 describe ".compare" do
77 before do
78 stub_get("/projects/3/repository/compare", "compare_merge_request_diff").
79 with(query: { from: "master", to: "feature" })
80 @diff = Gitlab.compare(3, 'master', 'feature')
81 end
82
83 it "should get the correct resource" do
84 expect(a_get("/projects/3/repository/compare").
85 with(query: { from: "master", to: "feature" })).to have_been_made
86 end
87
88 it "should get diffs of a merge request" do
89 expect(@diff.diffs).to be_kind_of Array
90 expect(@diff.diffs.last["new_path"]).to eq "files/js/application.js"
91 end
92 end
93 end
+0
-95
spec/gitlab/client/repository_files_spec.rb less more
0 require "spec_helper"
1
2 describe Gitlab::Client do
3 describe ".file_contents" do
4 before do
5 stub_get("/projects/3/repository/files/Gemfile/raw?ref=master", "raw_file")
6 @file_contents = Gitlab.file_contents(3, "Gemfile")
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/repository/files/Gemfile/raw?ref=master")).to have_been_made
11 end
12
13 it "should return file contents" do
14 expect(@file_contents).to eq("source 'https://rubygems.org'\ngem 'rails', '4.1.2'\n")
15 end
16 end
17
18 describe ".get_file" do
19 before do
20 stub_get("/projects/3/repository/files/README%2Emd?ref=master", "get_repository_file")
21 @file = Gitlab.get_file(3, 'README.md', 'master')
22 end
23
24 it "should get the correct resource" do
25 expect(a_get("/projects/3/repository/files/README%2Emd?ref=master")).to have_been_made
26 end
27
28 it "should return the base64 encoded file" do
29 expect(@file.file_path).to eq "README.md"
30 expect(@file.ref).to eq "master"
31 expect(@file.content).to eq "VGhpcyBpcyBhICpSRUFETUUqIQ==\n"
32 end
33 end
34
35 describe ".create_file" do
36 let(:api_path) { "/projects/3/repository/files/path" }
37 let!(:request_stub) { stub_post(api_path, "repository_file") }
38 let!(:file) { Gitlab.create_file(3, "path", "branch", "content", "commit message", author_name: "joe") }
39
40 it "should create the correct resource" do
41 expected_parameters = {
42 author_name: "joe",
43 branch: "branch",
44 commit_message: "commit message"
45 }
46 expect(a_post(api_path).with(body: hash_including(expected_parameters))).to have_been_made
47 end
48
49 it "should return information about the new file" do
50 expect(file.file_path).to eq "path"
51 expect(file.branch_name).to eq "branch"
52 end
53 end
54
55 describe ".edit_file" do
56 let(:api_path) { "/projects/3/repository/files/path" }
57 let!(:request_stub) { stub_put(api_path, "repository_file") }
58 let!(:file) { Gitlab.edit_file(3, "path", "branch", "content", "commit message", author_name: "joe") }
59
60 it "should update the correct resource" do
61 expected_parameters = {
62 author_name: "joe",
63 branch: "branch",
64 commit_message: "commit message"
65 }
66 expect(a_put(api_path).with(body: hash_including(expected_parameters))).to have_been_made
67 end
68
69 it "should return information about the new file" do
70 expect(file.file_path).to eq "path"
71 expect(file.branch_name).to eq "branch"
72 end
73 end
74
75 describe ".remove_file" do
76 let(:api_path) { "/projects/3/repository/files/path" }
77 let!(:request_stub) { stub_delete(api_path, "repository_file") }
78 let!(:file) { Gitlab.remove_file(3, "path", "branch", "commit message", author_name: "joe") }
79
80 it "should update the correct resource" do
81 expected_parameters = {
82 author_name: "joe",
83 branch: "branch",
84 commit_message: "commit message"
85 }
86 expect(a_delete(api_path).with(body: hash_including(expected_parameters))).to have_been_made
87 end
88
89 it "should return information about the new file" do
90 expect(file.file_path).to eq "path"
91 expect(file.branch_name).to eq "branch"
92 end
93 end
94 end
+0
-185
spec/gitlab/client/runners_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3
4 describe ".runners" do
5 before do
6 stub_get("/runners", "runners")
7 end
8
9 context 'without scope' do
10 before do
11 @runner = Gitlab.runners
12 end
13
14 it "should get the correct resource" do
15 expect(a_get("/runners")).to have_been_made
16 end
17
18 it "should return a paginated response of runners" do
19 expect(@runner).to be_a Gitlab::PaginatedResponse
20 expect(@runner.first.id).to eq(6)
21 expect(@runner.first.description).to eq('test-1-20150125')
22 end
23 end
24
25 context 'with scope' do
26 before do
27 stub_get("/runners?scope=online", "runners")
28 @runner = Gitlab.runners({scope: :online})
29 end
30
31 it "should get the correct resource" do
32 expect(a_get("/runners").with(query: { scope: :online })).to have_been_made
33 end
34
35 it "should return a paginated response of runners" do
36 expect(@runner).to be_a Gitlab::PaginatedResponse
37 expect(@runner.first.id).to eq(6)
38 expect(@runner.first.description).to eq('test-1-20150125')
39 end
40 end
41
42 end
43
44 describe ".all_runners" do
45 before do
46 stub_get("/runners/all", "runners")
47 end
48
49 context 'without scope' do
50 before do
51 @runner = Gitlab.all_runners
52 end
53
54 it "should get the correct resource" do
55 expect(a_get("/runners/all")).to have_been_made
56 end
57
58 it "should return a paginated response of runners" do
59 expect(@runner).to be_a Gitlab::PaginatedResponse
60 expect(@runner.first.id).to eq(6)
61 expect(@runner.first.description).to eq('test-1-20150125')
62 end
63 end
64
65 context 'with scope' do
66 before do
67 stub_get("/runners/all?scope=online", "runners")
68 @runner = Gitlab.all_runners({scope: :online})
69 end
70
71 it "should get the correct resource" do
72 expect(a_get("/runners/all").with(query: { scope: :online })).to have_been_made
73 end
74
75 it "should return a paginated response of runners" do
76 expect(@runner).to be_a Gitlab::PaginatedResponse
77 expect(@runner.first.id).to eq(6)
78 expect(@runner.first.description).to eq('test-1-20150125')
79 end
80 end
81 end
82
83 describe ".runner" do
84 before do
85 stub_get("/runners/6", "runner")
86 @runners = Gitlab.runner(6)
87 end
88
89 it "should get the correct resource" do
90 expect(a_get("/runners/6")).to have_been_made
91 end
92
93 it "should return a response of a runner" do
94 expect(@runners).to be_a Gitlab::ObjectifiedHash
95 expect(@runners.id).to eq(6)
96 expect(@runners.description).to eq('test-1-20150125')
97 end
98 end
99
100 describe ".update_runner" do
101 before do
102 stub_put("/runners/6", "runner_edit").with(query: { description: "abcefg" })
103 @runner = Gitlab.update_runner(6, description: "abcefg" )
104 end
105
106 it "should get the correct resource" do
107 expect(a_put("/runners/6").with(query: { description: "abcefg" })).to have_been_made
108 end
109
110 it "should return an updated response of a runner" do
111 expect(@runner).to be_a Gitlab::ObjectifiedHash
112 expect(@runner.description).to eq('abcefg')
113 end
114 end
115
116 describe ".delete_runner" do
117 before do
118 stub_delete("/runners/6", "runner_delete")
119 @runner = Gitlab.delete_runner(6)
120 end
121
122 it "should get the correct resource" do
123 expect(a_delete("/runners/6")).to have_been_made
124 end
125
126 it "should return a response of the deleted runner" do
127 expect(@runner).to be_a Gitlab::ObjectifiedHash
128 expect(@runner.id).to eq(6)
129 end
130 end
131
132 describe ".project_runners" do
133 before do
134 stub_get("/projects/1/runners", "project_runners")
135 @runners = Gitlab.project_runners(1)
136 end
137
138 it "should get the correct resource" do
139 expect(a_get("/projects/1/runners")).to have_been_made
140 end
141
142 it "should return a paginated response of runners" do
143 expect(@runners).to be_a Gitlab::PaginatedResponse
144 expect(@runners.first.id).to eq(8)
145 expect(@runners.first.description).to eq('test-2-20150125')
146 end
147 end
148
149 describe ".project_enable_runner" do
150 before do
151 stub_post("/projects/1/runners", "runner")
152 @runner = Gitlab.project_enable_runner(1, 6)
153 end
154
155 it "should get the correct resource" do
156 expect(a_post("/projects/1/runners")).to have_been_made
157 end
158
159 it "should return a response of the enabled runner" do
160 expect(@runner).to be_a Gitlab::ObjectifiedHash
161 expect(@runner.id).to eq(6)
162 expect(@runner.description).to eq('test-1-20150125')
163 end
164 end
165
166 describe ".project_disable_runner" do
167 before do
168 stub_delete("/projects/1/runners/6", "runner")
169 @runner = Gitlab.project_disable_runner(1, 6)
170 end
171
172 it "should get the correct resource" do
173 expect(a_delete("/projects/1/runners/6")).to have_been_made
174 end
175
176 it "should return a response of the disabled runner" do
177 expect(@runner).to be_a Gitlab::ObjectifiedHash
178 expect(@runner.id).to eq(6)
179 expect(@runner.description).to eq('test-1-20150125')
180 end
181 end
182
183
184 end
+0
-55
spec/gitlab/client/services_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".service" do
4 before do
5 stub_get("/projects/3/services/redmine", "service")
6 @service = Gitlab.service(3, :redmine)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/services/redmine")).to have_been_made
11 end
12
13 it "should return a information about a service of project" do
14 expect(@service.id).to eq 38
15 expect(@service.title).to eq("Redmine")
16 expect(@service.properties.project_url).to eq("https://example.com/projects/test_project/issue")
17 end
18 end
19
20 describe ".change_service" do
21 before do
22 stub_put("/projects/3/services/redmine", "service")
23 @service = Gitlab.change_service(3, :redmine, new_issue_url: 'https://example.com/projects/test_project/issues/new',
24 project_url: 'https://example.com/projects/test_project/issues',
25 issues_url: 'https://example.com/issues/:id')
26 end
27
28 it "should get the correct resource" do
29 body = {new_issue_url: 'https://example.com/projects/test_project/issues/new',
30 project_url: 'https://example.com/projects/test_project/issues',
31 issues_url: 'https://example.com/issues/:id'}
32 expect(a_put("/projects/3/services/redmine").with(body: body)).to have_been_made
33 end
34
35 it "should return information about a new service" do
36 expect(@service).to be_truthy
37 end
38 end
39
40 describe ".delete_servoce" do
41 before do
42 stub_delete("/projects/3/services/redmine", "service")
43 @service = Gitlab.delete_service(3, :redmine)
44 end
45
46 it "should get the correct resource" do
47 expect(a_delete("/projects/3/services/redmine")).to have_been_made
48 end
49
50 it "should return information about a deleted service" do
51 expect(@service).to be_truthy
52 end
53 end
54 end
+0
-100
spec/gitlab/client/snippets_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".snippets" do
4 before do
5 stub_get("/projects/3/snippets", "snippets")
6 @snippets = Gitlab.snippets(3)
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/projects/3/snippets")).to have_been_made
11 end
12
13 it "should return a paginated response of project's snippets" do
14 expect(@snippets).to be_a Gitlab::PaginatedResponse
15 expect(@snippets.first.file_name).to eq("mailer_test.rb")
16 end
17 end
18
19 describe ".snippet" do
20 before do
21 stub_get("/projects/3/snippets/1", "snippet")
22 @snippet = Gitlab.snippet(3, 1)
23 end
24
25 it "should get the correct resource" do
26 expect(a_get("/projects/3/snippets/1")).to have_been_made
27 end
28
29 it "should return information about a snippet" do
30 expect(@snippet.file_name).to eq("mailer_test.rb")
31 expect(@snippet.author.name).to eq("John Smith")
32 end
33 end
34
35 describe ".create_snippet" do
36 before do
37 stub_post("/projects/3/snippets", "snippet")
38 @snippet = Gitlab.create_snippet(3, title: 'API', file_name: 'api.rb', code: 'code')
39 end
40
41 it "should get the correct resource" do
42 body = { title: 'API', file_name: 'api.rb', code: 'code' }
43 expect(a_post("/projects/3/snippets").with(body: body)).to have_been_made
44 end
45
46 it "should return information about a new snippet" do
47 expect(@snippet.file_name).to eq("mailer_test.rb")
48 expect(@snippet.author.name).to eq("John Smith")
49 end
50 end
51
52 describe ".edit_snippet" do
53 before do
54 stub_put("/projects/3/snippets/1", "snippet")
55 @snippet = Gitlab.edit_snippet(3, 1, file_name: 'mailer_test.rb')
56 end
57
58 it "should get the correct resource" do
59 expect(a_put("/projects/3/snippets/1").
60 with(body: { file_name: 'mailer_test.rb' })).to have_been_made
61 end
62
63 it "should return information about an edited snippet" do
64 expect(@snippet.file_name).to eq("mailer_test.rb")
65 expect(@snippet.author.name).to eq("John Smith")
66 end
67 end
68
69 describe ".delete_snippet" do
70 before do
71 stub_delete("/projects/3/snippets/1", "snippet")
72 @snippet = Gitlab.delete_snippet(3, 1)
73 end
74
75 it "should get the correct resource" do
76 expect(a_delete("/projects/3/snippets/1")).to have_been_made
77 end
78
79 it "should return information about a deleted snippet" do
80 expect(@snippet.file_name).to eq("mailer_test.rb")
81 expect(@snippet.author.name).to eq("John Smith")
82 end
83 end
84
85 describe ".snippet_content" do
86 before do
87 stub_get("/projects/3/snippets/1/raw", "snippet_content")
88 @snippet_content = Gitlab.snippet_content(3, 1)
89 end
90
91 it "should get the correct resource" do
92 expect(a_get("/projects/3/snippets/1/raw")).to have_been_made
93 end
94
95 it "should return raw content of a snippet" do
96 expect(@snippet_content).to eq("#!/usr/bin/env ruby\n\nputs \"Cool snippet!\"\n")
97 end
98 end
99 end
+0
-69
spec/gitlab/client/system_hooks_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 it { should respond_to :system_hooks }
4 it { should respond_to :add_system_hook }
5 it { should respond_to :system_hook }
6 it { should respond_to :delete_system_hook }
7
8 describe ".hooks" do
9 before do
10 stub_get("/hooks", "system_hooks")
11 @hooks = Gitlab.hooks
12 end
13
14 it "should get the correct resource" do
15 expect(a_get("/hooks")).to have_been_made
16 end
17
18 it "should return a paginated response of system hooks" do
19 expect(@hooks).to be_a Gitlab::PaginatedResponse
20 expect(@hooks.first.url).to eq("http://example.com/hook")
21 end
22 end
23
24 describe ".add_hook" do
25 before do
26 stub_post("/hooks", "system_hook")
27 @hook = Gitlab.add_hook("http://example.com/hook", token: 'secret-token')
28 end
29
30 it "should get the correct resource" do
31 expect(a_post("/hooks").with(body: hash_including(token: 'secret-token'))).to have_been_made
32 end
33
34 it "should return information about a added system hook" do
35 expect(@hook.url).to eq("http://example.com/hook")
36 end
37 end
38
39 describe ".hook" do
40 before do
41 stub_get("/hooks/3", "system_hook")
42 @hook = Gitlab.hook(3)
43 end
44
45 it "should get the correct resource" do
46 expect(a_get("/hooks/3")).to have_been_made
47 end
48
49 it "should return information about a added system hook" do
50 expect(@hook.url).to eq("http://example.com/hook")
51 end
52 end
53
54 describe ".delete_hook" do
55 before do
56 stub_delete("/hooks/3", "system_hook")
57 @hook = Gitlab.delete_hook(3)
58 end
59
60 it "should get the correct resource" do
61 expect(a_delete("/hooks/3")).to have_been_made
62 end
63
64 it "should return information about a deleted system hook" do
65 expect(@hook.url).to eq("http://example.com/hook")
66 end
67 end
68 end
+0
-109
spec/gitlab/client/tags_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 it { should respond_to :repo_tags }
4 it { should respond_to :repo_tag }
5 it { should respond_to :repo_create_tag }
6 it { should respond_to :repo_delete_tag }
7 it { should respond_to :repo_create_release }
8 it { should respond_to :repo_update_release }
9
10 describe '.tags' do
11 before do
12 stub_get("/projects/3/repository/tags", "tags")
13 @tags = Gitlab.tags(3)
14 end
15
16 it "should get the correct resource" do
17 expect(a_get("/projects/3/repository/tags")).to have_been_made
18 end
19
20 it "should return a paginated response of repository tags" do
21 expect(@tags).to be_a Gitlab::PaginatedResponse
22 expect(@tags.map(&:name)).to eq(%w[0.0.2 0.0.1])
23 end
24 end
25
26 describe ".tag" do
27 before do
28 stub_get("/projects/3/repository/tags/0.0.1", "tag")
29 @tag = Gitlab.tag(3, "0.0.1")
30 end
31
32 it "should get the correct resource" do
33 expect(a_get("/projects/3/repository/tags/0.0.1")).to have_been_made
34 end
35
36 it "should return information about a repository tag" do
37 expect(@tag.name).to eq("0.0.1")
38 end
39 end
40
41 describe ".create_tag" do
42 before do
43 stub_post("/projects/3/repository/tags", "tag_create")
44 @tag = Gitlab.create_tag(3, "0.0.1", "master", 'this tag is annotated', 'and it has release notes')
45 end
46
47 it "should get the correct resource" do
48 expect(a_post("/projects/3/repository/tags")).to have_been_made
49 end
50
51 it "should return information about a new repository tag" do
52 expect(@tag.name).to eq("0.0.1")
53 expect(@tag.message).to eq('this tag is annotated')
54 end
55
56 it "should return detailed information" do
57 expect(@tag.release.description).to eq('and it has release notes')
58 end
59 end
60
61 describe ".delete_tag" do
62 before do
63 stub_delete("/projects/3/repository/tags/0.0.1", "tag_delete")
64 @tag = Gitlab.delete_tag(3, "0.0.1")
65 end
66
67 it "should get the correct resource" do
68 expect(a_delete("/projects/3/repository/tags/0.0.1")).to have_been_made
69 end
70
71 it "should return information about the deleted repository tag" do
72 expect(@tag.tag_name).to eq("0.0.1")
73 end
74 end
75
76 describe ".create_release" do
77 before do
78 stub_post("/projects/3/repository/tags/0.0.1/release", "release_create")
79 @tag = Gitlab.create_release(3, "0.0.1", "Amazing release. Wow")
80 end
81
82 it "should get the correct resource" do
83 expect(a_post("/projects/3/repository/tags/0.0.1/release")).to have_been_made
84 end
85
86 it "should return information about the tag and the release" do
87 expect(@tag.tag_name).to eq("0.0.1")
88 expect(@tag.description).to eq("Amazing release. Wow")
89 end
90 end
91
92 describe ".update_release" do
93 before do
94 stub_put("/projects/3/repository/tags/0.0.1/release", "release_update")
95 @tag = Gitlab.update_release(3, "0.0.1", 'Amazing release. Wow')
96 end
97
98 it "should update the correct resource" do
99 expect(a_put("/projects/3/repository/tags/0.0.1/release")).to have_been_made
100 end
101
102 it "should return information about the tag" do
103 expect(@tag.tag_name).to eq("0.0.1")
104 expect(@tag.description).to eq('Amazing release. Wow')
105 end
106 end
107
108 end
+0
-45
spec/gitlab/client/todos_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe '.todos' do
4 before do
5 stub_get("/todos", "todos")
6 @todos = Gitlab.todos
7 end
8
9 it "should get the correct resources" do
10 expect(a_get("/todos")).to have_been_made
11 end
12
13 it "should return a paginated response of user's todos" do
14 expect(@todos).to be_a Gitlab::PaginatedResponse
15 end
16 end
17
18 describe '.mark_todo_as_done' do
19 before do
20 stub_post("/todos/102/mark_as_done", "todo")
21 @todo = Gitlab.mark_todo_as_done(102)
22 end
23
24 it "should get the correct resource" do
25 expect(a_post("/todos/102/mark_as_done")).to have_been_made
26 end
27
28 it "should return information about the todo marked as done" do
29 expect(@todo.id).to eq(102)
30 expect(@todo.state).to eq('done')
31 end
32 end
33
34 describe '.mark_all_todos_as_done' do
35 before do
36 stub_post("/todos/mark_as_done", "todos")
37 @todos = Gitlab.mark_all_todos_as_done
38 end
39
40 it "should get the correct resources" do
41 expect(a_post("/todos/mark_as_done")).to have_been_made
42 end
43 end
44 end
+0
-418
spec/gitlab/client/users_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Client do
3 describe ".users" do
4 before do
5 stub_get("/users", "users")
6 @users = Gitlab.users
7 end
8
9 it "should get the correct resource" do
10 expect(a_get("/users")).to have_been_made
11 end
12
13 it "should return a paginated response of users" do
14 expect(@users).to be_a Gitlab::PaginatedResponse
15 expect(@users.first.email).to eq("john@example.com")
16 end
17 end
18
19 describe ".user" do
20 context "with user ID passed" do
21 before do
22 stub_get("/users/1", "user")
23 @user = Gitlab.user(1)
24 end
25
26 it "should get the correct resource" do
27 expect(a_get("/users/1")).to have_been_made
28 end
29
30 it "should return information about a user" do
31 expect(@user.email).to eq("john@example.com")
32 end
33 end
34
35 context "without user ID passed" do
36 before do
37 stub_get("/user", "user")
38 @user = Gitlab.user
39 end
40
41 it "should get the correct resource" do
42 expect(a_get("/user")).to have_been_made
43 end
44
45 it "should return information about an authorized user" do
46 expect(@user.email).to eq("john@example.com")
47 end
48 end
49 end
50
51 describe ".create_user" do
52 context "when successful request" do
53 before do
54 stub_post("/users", "user")
55 @user = Gitlab.create_user("email", "pass")
56 end
57
58 it "should get the correct resource" do
59 body = { email: "email", password: "pass", name: "email" }
60 expect(a_post("/users").with(body: body)).to have_been_made
61 end
62
63 it "should return information about a created user" do
64 expect(@user.email).to eq("john@example.com")
65 end
66 end
67
68 context "when bad request" do
69 it "should throw an exception" do
70 stub_post("/users", "error_already_exists", 409)
71 expect do
72 Gitlab.create_user("email", "pass")
73 end.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users")
74 end
75 end
76 end
77
78 describe ".create_user_with_userame" do
79 context "when successful request" do
80 before do
81 stub_post("/users", "user")
82 @user = Gitlab.create_user("email", "pass", "username")
83 end
84
85 it "should get the correct resource" do
86 body = { email: "email", password: "pass", username: "username" }
87 expect(a_post("/users").with(body: body)).to have_been_made
88 end
89
90 it "should return information about a created user" do
91 expect(@user.email).to eq("john@example.com")
92 end
93 end
94
95 context "when bad request" do
96 it "should throw an exception" do
97 stub_post("/users", "error_already_exists", 409)
98 expect do
99 Gitlab.create_user("email", "pass", "username")
100 end.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users")
101 end
102 end
103 end
104
105 describe ".edit_user" do
106 before do
107 @options = { name: "Roberto" }
108 stub_put("/users/1", "user").with(body: @options)
109 @user = Gitlab.edit_user(1, @options)
110 end
111
112 it "should get the correct resource" do
113 expect(a_put("/users/1").with(body: @options)).to have_been_made
114 end
115 end
116
117 describe ".delete_user" do
118 before do
119 stub_delete("/users/1", "user")
120 @user = Gitlab.delete_user(1)
121 end
122
123 it "should get the correct resource" do
124 expect(a_delete("/users/1")).to have_been_made
125 end
126
127 it "should return information about a deleted user" do
128 expect(@user.email).to eq("john@example.com")
129 end
130 end
131
132 describe ".block_user" do
133 before do
134 stub_post("/users/1/block", "user_block_unblock")
135 @result = Gitlab.block_user(1)
136 end
137
138 it "should get the correct resource" do
139 expect(a_post("/users/1/block")).to have_been_made
140 end
141
142 it "should return boolean" do
143 expect(@result).to eq(true)
144 end
145 end
146
147 describe ".unblock_user" do
148 before do
149 stub_post("/users/1/unblock", "user_block_unblock")
150 @result = Gitlab.unblock_user(1)
151 end
152
153 it "should get the correct resource" do
154 expect(a_post("/users/1/unblock")).to have_been_made
155 end
156
157 it "should return boolean" do
158 expect(@result).to eq(true)
159 end
160 end
161
162 describe ".session" do
163 after do
164 Gitlab.endpoint = 'https://api.example.com'
165 Gitlab.private_token = 'secret'
166 end
167
168 before do
169 stub_request(:post, "#{Gitlab.endpoint}/session").
170 to_return(body: load_fixture('session'), status: 200)
171 @session = Gitlab.session("email", "pass")
172 end
173
174 context "when endpoint is not set" do
175 it "should raise Error::MissingCredentials" do
176 Gitlab.endpoint = nil
177 expect do
178 Gitlab.session("email", "pass")
179 end.to raise_error(Gitlab::Error::MissingCredentials, 'Please set an endpoint to API')
180 end
181 end
182
183 context "when private_token is not set" do
184 it "should not raise Error::MissingCredentials" do
185 Gitlab.private_token = nil
186 expect { Gitlab.session("email", "pass") }.to_not raise_error
187 end
188 end
189
190 context "when endpoint is set" do
191 it "should get the correct resource" do
192 expect(a_request(:post, "#{Gitlab.endpoint}/session")).to have_been_made
193 end
194
195 it "should return information about a created session" do
196 expect(@session.email).to eq("john@example.com")
197 expect(@session.private_token).to eq("qEsq1pt6HJPaNciie3MG")
198 end
199 end
200 end
201
202 describe ".ssh_keys" do
203 context "with user ID passed" do
204 before do
205 stub_get("/users/1/keys", "keys")
206 @keys = Gitlab.ssh_keys({ user_id: 1 })
207 end
208
209 it "should get the correct resource" do
210 expect(a_get("/users/1/keys")).to have_been_made
211 end
212
213 it "should return a paginated response of SSH keys" do
214 expect(@keys).to be_a Gitlab::PaginatedResponse
215 expect(@keys.first.title).to eq("narkoz@helium")
216 end
217 end
218
219 context "without user ID passed" do
220 before do
221 stub_get("/user/keys", "keys")
222 @keys = Gitlab.ssh_keys
223 end
224
225 it "should get the correct resource" do
226 expect(a_get("/user/keys")).to have_been_made
227 end
228
229 it "should return a paginated response of SSH keys" do
230 expect(@keys).to be_a Gitlab::PaginatedResponse
231 expect(@keys.first.title).to eq("narkoz@helium")
232 end
233 end
234 end
235
236 describe ".ssh_key" do
237 before do
238 stub_get("/user/keys/1", "key")
239 @key = Gitlab.ssh_key(1)
240 end
241
242 it "should get the correct resource" do
243 expect(a_get("/user/keys/1")).to have_been_made
244 end
245
246 it "should return information about an SSH key" do
247 expect(@key.title).to eq("narkoz@helium")
248 end
249 end
250
251 describe ".create_ssh_key" do
252 before do
253 stub_post("/user/keys", "key")
254 @key = Gitlab.create_ssh_key("title", "body")
255 end
256
257 it "should get the correct resource" do
258 body = { title: "title", key: "body" }
259 expect(a_post("/user/keys").with(body: body)).to have_been_made
260 end
261
262 it "should return information about a created SSH key" do
263 expect(@key.title).to eq("narkoz@helium")
264 end
265 end
266
267 describe ".delete_ssh_key" do
268 before do
269 stub_delete("/user/keys/1", "key")
270 @key = Gitlab.delete_ssh_key(1)
271 end
272
273 it "should get the correct resource" do
274 expect(a_delete("/user/keys/1")).to have_been_made
275 end
276
277 it "should return information about a deleted SSH key" do
278 expect(@key.title).to eq("narkoz@helium")
279 end
280 end
281
282 describe ".emails" do
283 describe "without user ID" do
284 before do
285 stub_get("/user/emails", "user_emails")
286 @emails = Gitlab.emails
287 end
288
289 it "should get the correct resource" do
290 expect(a_get("/user/emails")).to have_been_made
291 end
292
293 it "should return a information about a emails of user" do
294 email = @emails.first
295 expect(email.id).to eq 1
296 expect(email.email).to eq("email@example.com")
297 end
298 end
299
300 describe "with user ID" do
301 before do
302 stub_get("/users/2/emails", "user_emails")
303 @emails = Gitlab.emails(2)
304 end
305
306 it "should get the correct resource" do
307 expect(a_get("/users/2/emails")).to have_been_made
308 end
309
310 it "should return a information about a emails of user" do
311 email = @emails.first
312 expect(email.id).to eq 1
313 expect(email.email).to eq("email@example.com")
314 end
315 end
316 end
317
318 describe ".email" do
319 before do
320 stub_get("/user/emails/2", "user_email")
321 @email = Gitlab.email(2)
322 end
323
324 it "should get the correct resource" do
325 expect(a_get("/user/emails/2")).to have_been_made
326 end
327
328 it "should return a information about a email of user" do
329 expect(@email.id).to eq 1
330 expect(@email.email).to eq("email@example.com")
331 end
332 end
333
334 describe ".add_email" do
335 describe "without user ID" do
336 before do
337 stub_post("/user/emails", "user_email")
338 @email = Gitlab.add_email("email@example.com")
339 end
340
341 it "should get the correct resource" do
342 body = { email: "email@example.com" }
343 expect(a_post("/user/emails").with(body: body)).to have_been_made
344 end
345
346 it "should return information about a new email" do
347 expect(@email.id).to eq(1)
348 expect(@email.email).to eq("email@example.com")
349 end
350 end
351
352 describe "with user ID" do
353 before do
354 stub_post("/users/2/emails", "user_email")
355 @email = Gitlab.add_email("email@example.com", 2)
356 end
357
358 it "should get the correct resource" do
359 body = { email: "email@example.com" }
360 expect(a_post("/users/2/emails").with(body: body)).to have_been_made
361 end
362
363 it "should return information about a new email" do
364 expect(@email.id).to eq(1)
365 expect(@email.email).to eq("email@example.com")
366 end
367 end
368 end
369
370 describe ".delete_email" do
371 describe "without user ID" do
372 before do
373 stub_delete("/user/emails/1", "user_email")
374 @email = Gitlab.delete_email(1)
375 end
376
377 it "should get the correct resource" do
378 expect(a_delete("/user/emails/1")).to have_been_made
379 end
380
381 it "should return information about a deleted email" do
382 expect(@email).to be_truthy
383 end
384 end
385
386 describe "with user ID" do
387 before do
388 stub_delete("/users/2/emails/1", "user_email")
389 @email = Gitlab.delete_email(1, 2)
390 end
391
392 it "should get the correct resource" do
393 expect(a_delete("/users/2/emails/1")).to have_been_made
394 end
395
396 it "should return information about a deleted email" do
397 expect(@email).to be_truthy
398 end
399 end
400 end
401
402 describe ".user_search" do
403 before do
404 stub_get("/users?search=User", "user_search")
405 @users = Gitlab.user_search('User')
406 end
407
408 it "should get the correct resource" do
409 expect(a_get("/users?search=User")).to have_been_made
410 end
411
412 it "should return an array of users found" do
413 expect(@users.first.id).to eq(1)
414 expect(@users.last.id).to eq(2)
415 end
416 end
417 end
+0
-45
spec/gitlab/error_spec.rb less more
0 require "spec_helper"
1
2 describe Gitlab::Error do
3 describe "#handle_message" do
4 require "stringio"
5
6 before do
7 request_object = HTTParty::Request.new(Net::HTTP::Get, '/')
8 response_object = Net::HTTPOK.new('1.1', 200, 'OK')
9 body = StringIO.new("{foo:'bar'}")
10 def body.message; self.string; end
11
12 parsed_response = lambda { body }
13 response_object['last-modified'] = Date.new(2010, 1, 15).to_s
14 response_object['content-length'] = "1024"
15
16 response = HTTParty::Response.new(request_object, response_object, parsed_response, body: body)
17 @error = Gitlab::Error::ResponseError.new(response)
18
19 @array = Array.new(['First message.', 'Second message.'])
20 @obj_h = Gitlab::ObjectifiedHash.new(user: ['not set'],
21 password: ['too short'],
22 embed_entity: { foo: ['bar'], sna: ['fu'] })
23 end
24
25 context "when passed an ObjectifiedHash" do
26 it "should return a joined string of error messages sorted by key" do
27 expect(@error.send(:handle_message, @obj_h)).to eq("'embed_entity' (foo: bar) (sna: fu), 'password' too short, 'user' not set")
28 end
29 end
30
31 context "when passed an Array" do
32 it "should return a joined string of messages" do
33 expect(@error.send(:handle_message, @array)).to eq("First message. Second message.")
34 end
35 end
36
37 context "when passed a String" do
38 it "should return the String untouched" do
39 error = 'this is an error string'
40 expect(@error.send(:handle_message, error)).to eq('this is an error string')
41 end
42 end
43 end
44 end
+0
-33
spec/gitlab/file_response_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::FileResponse do
3 before do
4 @file_response = Gitlab::FileResponse.new StringIO.new("", 'rb+')
5 end
6
7 context '.empty?' do
8 it "shoudl return false" do
9 expect(@file_response.empty?).to be false
10 end
11 end
12
13 context '.to_hash' do
14 it "should have `filename` key and `data` key" do
15 h = @file_response.to_hash
16 expect(h.has_key?(:filename)).to be_truthy
17 expect(h.has_key?(:data)).to be_truthy
18 end
19 end
20
21 context '.parse_headers!' do
22 it "should parse headers" do
23 @file_response.parse_headers!('Content-Disposition' => 'attachment; filename=artifacts.zip')
24 expect(@file_response.filename).to eq "artifacts.zip"
25 end
26
27 it "should handle quoted filenames" do
28 @file_response.parse_headers!('Content-Disposition' => 'attachment; filename="artifacts.zip"')
29 expect(@file_response.filename).to eq "artifacts.zip"
30 end
31 end
32 end
+0
-46
spec/gitlab/help_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Help do
3 describe ".ri_cmd" do
4 context "ri command found" do
5 it "should return the path to RI" do
6 allow(Gitlab::Help).to receive(:`).with(/which ri/).and_return('/usr/bin/ri')
7 expect(Gitlab::Help.ri_cmd).to eq('/usr/bin/ri')
8 end
9 end
10
11 context "ri command NOT found" do
12 it "should raise" do
13 allow(Gitlab::Help).to receive(:`).with(/which ri/).and_return('')
14 expect { Gitlab::Help.ri_cmd }.to raise_error RuntimeError
15 end
16 end
17 end
18
19 describe ".change_help_output!" do
20 before do
21 @cmd = "create_branch"
22 @help_output = "Gitlab.#{@cmd}(4, 'new-branch', 'master')"
23 @help_output_with_options = "Gitlab.groups({ per_page: 3 })"
24 end
25 it "should return a String of modified output" do
26 Gitlab::Help.change_help_output! @cmd, @help_output
27 expect(@help_output).to eq("Gitlab.create_branch 4 'new-branch' 'master'")
28 end
29 it "should format options hash and return a String of modified output" do
30 Gitlab::Help.change_help_output! 'groups', @help_output_with_options
31 expect(@help_output_with_options).to eq("Gitlab.groups \"{ per_page: 3 }\"")
32 end
33 end
34
35 describe ".namespace" do
36 before do
37 @cmd = 'create_tag'
38 @namespace = Gitlab::Help.namespace @cmd
39 end
40 it "should return the full namespace for a command" do
41 expect(@namespace).to be_a String
42 expect(@namespace).to eq("Gitlab::Client::Tags.#{@cmd}")
43 end
44 end
45 end
+0
-48
spec/gitlab/objectified_hash_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::ObjectifiedHash do
3 before do
4 @hash = { a: 1, b: 2, 'string' => 'string', symbol: :symbol }
5 @oh = Gitlab::ObjectifiedHash.new @hash
6 end
7
8 it "should objectify hash" do
9 expect(@oh.a).to eq(@hash[:a])
10 expect(@oh.b).to eq(@hash[:b])
11 end
12
13 describe "#to_hash" do
14 it "should return an original hash" do
15 expect(@oh.to_hash).to eq(@hash)
16 end
17
18 it "should have an alias #to_h" do
19 expect(@oh.respond_to?(:to_h)).to be_truthy
20 end
21 end
22
23 describe "#inspect" do
24 it "should return a formatted string" do
25 pretty_string = "#<#{@oh.class.name}:#{@oh.object_id} {hash: #{@hash}}"
26 expect(@oh.inspect).to eq(pretty_string)
27 end
28 end
29
30 describe "#respond_to" do
31 it "should return true for methods this object responds to through method_missing as sym" do
32 expect(@oh.respond_to?(:a)).to be_truthy
33 end
34
35 it "should return true for methods this object responds to through method_missing as string" do
36 expect(@oh.respond_to?('string')).to be_truthy
37 end
38
39 it "should not care if you use a string or symbol to reference a method" do
40 expect(@oh.respond_to?(:string)).to be_truthy
41 end
42
43 it "should not care if you use a string or symbol to reference a method" do
44 expect(@oh.respond_to?('symbol')).to be_truthy
45 end
46 end
47 end
+0
-16
spec/gitlab/page_links_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::PageLinks do
3 before do
4 @page_links = Gitlab::PageLinks.new('Link' => "<http://example.com/api/v3/projects?page=1&per_page=5>; rel=\"first\", <http://example.com/api/v3/projects?page=20&per_page=5>; rel=\"last\", <http://example.com/api/v3/projects?page=7&per_page=5>; rel=\"prev\", <http://example.com/api/v3/projects?page=9&per_page=5>; rel=\"next\"")
5 end
6
7 context '.extract_links' do
8 it 'should extract link header appropriately' do
9 expect(@page_links.last).to eql 'http://example.com/api/v3/projects?page=20&per_page=5'
10 expect(@page_links.first).to eql 'http://example.com/api/v3/projects?page=1&per_page=5'
11 expect(@page_links.next).to eql 'http://example.com/api/v3/projects?page=9&per_page=5'
12 expect(@page_links.prev).to eql 'http://example.com/api/v3/projects?page=7&per_page=5'
13 end
14 end
15 end
+0
-60
spec/gitlab/paginated_response_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::PaginatedResponse do
3 before do
4 array = [1, 2, 3, 4]
5 @paginated_response = Gitlab::PaginatedResponse.new array
6 end
7
8 it "should respond to *_page and has_*_page methods" do
9 expect(@paginated_response).to respond_to :first_page
10 expect(@paginated_response).to respond_to :last_page
11 expect(@paginated_response).to respond_to :next_page
12 expect(@paginated_response).to respond_to :prev_page
13 expect(@paginated_response).to respond_to :has_first_page?
14 expect(@paginated_response).to respond_to :has_last_page?
15 expect(@paginated_response).to respond_to :has_next_page?
16 expect(@paginated_response).to respond_to :has_prev_page?
17 end
18
19 context '.parse_headers!' do
20 it "should parse headers" do
21 @paginated_response.parse_headers!('Link' => "<http://example.com/api/v3/projects?page=1&per_page=5>; rel=\"first\", <http://example.com/api/v3/projects?page=20&per_page=5>; rel=\"last\"")
22 client = @paginated_response.client = double('client')
23 first_page_response = double('first_page_response')
24 last_page_response = double('last_page_response')
25 allow(client).to receive(:endpoint).and_return("http://example.com/api/v3")
26 allow(client).to receive(:get).with("/projects?page=1&per_page=5").and_return(first_page_response)
27 allow(client).to receive(:get).with("/projects?page=20&per_page=5").and_return(last_page_response)
28 expect(@paginated_response.has_first_page?).to be true
29 expect(@paginated_response.has_last_page?).to be true
30 expect(@paginated_response.has_next_page?).to be false
31 expect(@paginated_response.has_prev_page?).to be false
32 expect(@paginated_response.first_page).to be first_page_response
33 expect(@paginated_response.last_page).to be last_page_response
34 expect(@paginated_response.next_page).to be_nil
35 expect(@paginated_response.prev_page).to be_nil
36 end
37 end
38
39 context '.each_page' do
40 it "should iterate pages" do
41 next_page = double('next_page')
42 allow(@paginated_response).to receive(:has_next_page?).and_return(true)
43 allow(@paginated_response).to receive(:next_page).and_return(next_page)
44 allow(next_page).to receive(:has_next_page?).and_return(false)
45 expect { |b| @paginated_response.each_page(&b) }.to yield_successive_args(@paginated_response, next_page)
46 end
47 end
48
49 context '.auto_paginate' do
50 it "should returns an array if block is not given" do
51 next_page = double('next_page')
52 allow(@paginated_response).to receive(:has_next_page?).and_return(true)
53 allow(@paginated_response).to receive(:next_page).and_return(next_page)
54 allow(next_page).to receive(:has_next_page?).and_return(false)
55 allow(next_page).to receive(:to_ary).and_return([5, 6, 7, 8])
56 expect(@paginated_response.auto_paginate).to contain_exactly(1, 2, 3, 4, 5, 6, 7, 8)
57 end
58 end
59 end
+0
-73
spec/gitlab/request_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Request do
3 it { should respond_to :get }
4 it { should respond_to :post }
5 it { should respond_to :put }
6 it { should respond_to :delete }
7 before do
8 @request = Gitlab::Request.new
9 end
10
11 describe ".default_options" do
12 it "should have default values" do
13 default_options = Gitlab::Request.default_options
14 expect(default_options).to be_a Hash
15 expect(default_options[:parser]).to be_a Proc
16 expect(default_options[:format]).to eq(:json)
17 expect(default_options[:headers]).to eq('Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded')
18 expect(default_options[:default_params]).to be_nil
19 end
20 end
21
22 describe ".parse" do
23 it "should return ObjectifiedHash" do
24 body = JSON.unparse(a: 1, b: 2)
25 expect(Gitlab::Request.parse(body)).to be_an Gitlab::ObjectifiedHash
26 expect(Gitlab::Request.parse("true")).to be true
27 expect(Gitlab::Request.parse("false")).to be false
28
29 expect { Gitlab::Request.parse("string") }.to raise_error(Gitlab::Error::Parsing)
30 end
31 end
32
33 describe "#set_request_defaults" do
34 context "when endpoint is not set" do
35 it "should raise Error::MissingCredentials" do
36 @request.endpoint = nil
37 expect do
38 @request.set_request_defaults
39 end.to raise_error(Gitlab::Error::MissingCredentials, 'Please set an endpoint to API')
40 end
41 end
42
43 context "when endpoint is set" do
44 before(:each) do
45 @request.endpoint = 'http://rabbit-hole.example.org'
46 end
47
48 it "should set default_params" do
49 @request.set_request_defaults('sudoer')
50 expect(Gitlab::Request.default_params).to eq(sudo: 'sudoer')
51 end
52 end
53 end
54
55 describe "#set_authorization_header" do
56 it "should raise MissingCredentials when auth_token and private_token are not set" do
57 expect do
58 @request.send(:set_authorization_header, {})
59 end.to raise_error(Gitlab::Error::MissingCredentials)
60 end
61
62 it "should set the correct header when given a private_token" do
63 @request.private_token = 'ys9BtunN3rDKbaJCYXaN'
64 expect(@request.send(:set_authorization_header, {})).to eq("PRIVATE-TOKEN" => 'ys9BtunN3rDKbaJCYXaN')
65 end
66
67 it "should set the correct header when setting an auth_token via the private_token config option" do
68 @request.private_token = '3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603'
69 expect(@request.send(:set_authorization_header, {})).to eq("Authorization" => "Bearer 3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603")
70 end
71 end
72 end
+0
-53
spec/gitlab/shell_history_spec.rb less more
0 require 'spec_helper'
1 require 'tempfile'
2
3 describe Gitlab::Shell::History do
4 context 'saving to a file' do
5 before do
6 @file = Tempfile.new('.gitlab_shell_history')
7 @history = Gitlab::Shell::History.new(file_path: @file.path)
8 end
9
10 after { @file.close(true) }
11
12 it 'saves the lines' do
13 @history << 'party on, dudes'
14 @history << 'be excellent to each other'
15 @history.save
16 expect(File.read @file.path).
17 to eq("party on, dudes\nbe excellent to each other\n")
18 end
19
20 it 'has the lines' do
21 @history << 'party on, dudes'
22 @history << 'be excellent to each other'
23 expect(@history.lines).
24 to eq(["party on, dudes", "be excellent to each other"])
25 end
26
27 it 'limits the lines to GITLAB_HISTFILESIZE' do
28 ENV['GITLAB_HISTFILESIZE'] = '2'
29 @history << 'bogus'
30 @history << 'party on, dudes'
31 @history << 'be excellent to each other'
32 @history.save
33 expect(@history.lines).
34 to eq(["party on, dudes", "be excellent to each other"])
35 expect(File.read @file.path).
36 to eq("party on, dudes\nbe excellent to each other\n")
37 end
38 end
39
40 context 'loading a file' do
41 before do
42 @file = load_fixture('shell_history')
43 @history = Gitlab::Shell::History.new(file_path: @file.path)
44 end
45
46 it 'has the lines' do
47 @history.load
48 expect(@history.lines).
49 to eq(["party on, dudes", "be excellent to each other"])
50 end
51 end
52 end
+0
-80
spec/gitlab/shell_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab::Shell do
3 before do
4 Gitlab::Shell.setup
5 end
6
7 describe ".execute" do
8 context "invalid command" do
9 it "should raise" do
10 expect { Gitlab::Shell.execute 'foobar', [] }.to raise_error(RuntimeError)
11 end
12 end
13 end
14
15 describe ".history" do
16 before do
17 @history = Gitlab::Shell.history
18 end
19
20 it "should return a Gitlab::Shell::History instance" do
21 expect(@history).to be_a Gitlab::Shell::History
22 end
23 it "should respond to :save" do
24 expect(@history).to respond_to :save
25 end
26 it "should respond to :load" do
27 expect(@history).to respond_to :load
28 end
29 it "should respond to :<<" do
30 expect(@history).to respond_to :<<
31 end
32 end
33
34 describe ".setup" do
35 it "should set the Readline completion_proc" do
36 completion = Readline.completion_proc
37 expect(completion).to be_truthy
38 expect(completion).to be_a Proc
39 end
40 it "should set the Readline completion_append_character" do
41 completion_character = Readline.completion_append_character
42 expect(completion_character).to eq(' ')
43 end
44 end
45
46 describe ".completion" do
47 before do
48 @comp = Gitlab::Shell.completion
49 end
50 it "should return a Proc object" do
51 expect(@comp).to be_a Proc
52 end
53 context "called with an argument" do
54 it "should return an Array of matching commands" do
55 completed_cmds = @comp.call 'group'
56 expect(completed_cmds).to be_a Array
57 expect(completed_cmds.sort).to eq(%w(group group_members group_projects group_search groups))
58 end
59 end
60 end
61
62 describe ".parse_input" do
63 context "with arguments" do
64 it "should set command & arguments" do
65 Gitlab::Shell.parse_input('create_branch 1 "api" "master"')
66 expect(Gitlab::Shell.command).to eq('create_branch')
67 expect(Gitlab::Shell.arguments).to eq(%w(1 api master))
68 end
69 end
70
71 context "without arguments" do
72 it 'should set command & empty arguments' do
73 Gitlab::Shell.parse_input('exit')
74 expect(Gitlab::Shell.command).to eq('exit')
75 expect(Gitlab::Shell.arguments).to be_empty
76 end
77 end
78 end
79 end
+0
-97
spec/gitlab_spec.rb less more
0 require 'spec_helper'
1
2 describe Gitlab do
3 after { Gitlab.reset }
4
5 describe ".client" do
6 it "should be a Gitlab::Client" do
7 expect(Gitlab.client).to be_a Gitlab::Client
8 end
9
10 it "should not override each other" do
11 client1 = Gitlab.client(endpoint: 'https://api1.example.com', private_token: '001')
12 client2 = Gitlab.client(endpoint: 'https://api2.example.com', private_token: '002')
13 expect(client1.endpoint).to eq('https://api1.example.com')
14 expect(client2.endpoint).to eq('https://api2.example.com')
15 expect(client1.private_token).to eq('001')
16 expect(client2.private_token).to eq('002')
17 end
18
19 it "should set private_token to the auth_token when provided" do
20 client = Gitlab.client(endpoint: 'https://api2.example.com', auth_token: '3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603')
21 expect(client.private_token).to eq('3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603')
22 end
23 end
24
25 describe ".actions" do
26 it "should return an array of client methods" do
27 actions = Gitlab.actions
28 expect(actions).to be_an Array
29 expect(actions.first).to be_a Symbol
30 expect(actions.sort.first).to eq(:accept_merge_request)
31 end
32 end
33
34 describe ".endpoint=" do
35 it "should set endpoint" do
36 Gitlab.endpoint = 'https://api.example.com'
37 expect(Gitlab.endpoint).to eq('https://api.example.com')
38 end
39 end
40
41 describe ".private_token=" do
42 it "should set private_token" do
43 Gitlab.private_token = 'secret'
44 expect(Gitlab.private_token).to eq('secret')
45 end
46 end
47
48 describe ".auth_token=" do
49 it "should set auth_token", focus: true do
50 Gitlab.auth_token = 'auth_secret'
51 expect(Gitlab.private_token).to eq('auth_secret')
52 end
53 end
54
55 describe ".sudo=" do
56 it "should set sudo" do
57 Gitlab.sudo = 'user'
58 expect(Gitlab.sudo).to eq('user')
59 end
60 end
61
62 describe ".user_agent" do
63 it "should return default user_agent" do
64 expect(Gitlab.user_agent).to eq(Gitlab::Configuration::DEFAULT_USER_AGENT)
65 end
66 end
67
68 describe ".user_agent=" do
69 it "should set user_agent" do
70 Gitlab.user_agent = 'Custom User Agent'
71 expect(Gitlab.user_agent).to eq('Custom User Agent')
72 end
73 end
74
75 describe ".configure" do
76 Gitlab::Configuration::VALID_OPTIONS_KEYS.each do |key|
77 it "should set #{key}" do
78 Gitlab.configure do |config|
79 config.send("#{key}=", key)
80 expect(Gitlab.send(key)).to eq(key)
81 end
82 end
83 end
84 end
85
86 describe ".http_proxy" do
87 it "delegates the method to Gitlab::Request" do
88 Gitlab.endpoint = 'https://api.example.com'
89 request = class_spy(Gitlab::Request).as_stubbed_const
90
91 Gitlab.http_proxy('fazbearentertainment.com', 1987, 'ffazbear', 'itsme')
92 expect(request).to have_received(:http_proxy).
93 with('fazbearentertainment.com', 1987, 'ffazbear', 'itsme')
94 end
95 end
96 end
+0
-74
spec/spec_helper.rb less more
0 require 'rspec'
1 require 'webmock/rspec'
2
3 require File.expand_path('../../lib/gitlab', __FILE__)
4 require File.expand_path('../../lib/gitlab/cli', __FILE__)
5
6 def capture_output
7 out = StringIO.new
8 $stdout = out
9 $stderr = out
10 yield
11 $stdout = STDOUT
12 $stderr = STDERR
13 out.string
14 end
15
16 def load_fixture(name)
17 File.new(File.dirname(__FILE__) + "/fixtures/#{name}.json")
18 end
19
20 RSpec.configure do |config|
21 config.before(:all) do
22 Gitlab.endpoint = 'https://api.example.com'
23 Gitlab.private_token = 'secret'
24 end
25 end
26
27 # GET
28 def stub_get(path, fixture, status_code=200)
29 stub_request(:get, "#{Gitlab.endpoint}#{path}").
30 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
31 to_return(body: load_fixture(fixture), status: status_code)
32 end
33
34 def a_get(path)
35 a_request(:get, "#{Gitlab.endpoint}#{path}").
36 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token })
37 end
38
39 # POST
40 def stub_post(path, fixture, status_code=200)
41 stub_request(:post, "#{Gitlab.endpoint}#{path}").
42 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
43 to_return(body: load_fixture(fixture), status: status_code)
44 end
45
46 def a_post(path)
47 a_request(:post, "#{Gitlab.endpoint}#{path}").
48 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token })
49 end
50
51 # PUT
52 def stub_put(path, fixture)
53 stub_request(:put, "#{Gitlab.endpoint}#{path}").
54 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
55 to_return(body: load_fixture(fixture))
56 end
57
58 def a_put(path)
59 a_request(:put, "#{Gitlab.endpoint}#{path}").
60 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token })
61 end
62
63 # DELETE
64 def stub_delete(path, fixture)
65 stub_request(:delete, "#{Gitlab.endpoint}#{path}").
66 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
67 to_return(body: load_fixture(fixture))
68 end
69
70 def a_delete(path)
71 a_request(:delete, "#{Gitlab.endpoint}#{path}").
72 with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token })
73 end