diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2137940..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: ruby -rvm: - - 2.0 - - 2.1 - - 2.2 - - 2.3 - - 2.4.0 -before_install: gem update bundler diff --git a/CHANGELOG.md b/CHANGELOG.md index 62637f0..6f3961b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ -## Change Log - -### Unreleased +## CHANGELOG + +### Newer releases + +Please see: https://github.com/NARKOZ/gitlab/releases ### 4.2.0 (13/07/2017) - Use `url_encode` in all `Commit` resources (@grodowski) diff --git a/README.md b/README.md index 510b407..35d5c76 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ # Gitlab -[![Build Status](https://img.shields.io/travis/NARKOZ/gitlab.svg?style=flat)](https://travis-ci.org/NARKOZ/gitlab) -[![Code Climate](https://img.shields.io/codeclimate/github/NARKOZ/gitlab.svg?style=flat)](https://codeclimate.com/github/NARKOZ/gitlab) -[![Inline docs](http://inch-ci.org/github/NARKOZ/gitlab.svg?style=flat)](https://inch-ci.org/github/NARKOZ/gitlab) -[![Gem version](https://img.shields.io/gem/v/gitlab.svg?style=flat)](https://rubygems.org/gems/gitlab) -[![License](https://img.shields.io/badge/license-BSD-red.svg?style=flat)](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt) +[![Build Status](https://img.shields.io/travis/NARKOZ/gitlab.svg)](https://travis-ci.org/NARKOZ/gitlab) +[![Code Climate](https://img.shields.io/codeclimate/maintainability/NARKOZ/gitlab.svg)](https://codeclimate.com/github/NARKOZ/gitlab) +[![Inline docs](http://inch-ci.org/github/NARKOZ/gitlab.svg)](https://inch-ci.org/github/NARKOZ/gitlab) +[![Gem version](https://img.shields.io/gem/v/gitlab.svg)](https://rubygems.org/gems/gitlab) +[![License](https://img.shields.io/badge/license-BSD-red.svg)](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt) [website](http://narkoz.github.io/gitlab) | [documentation](http://rubydoc.info/gems/gitlab/frames) | [gitlab-live](https://github.com/NARKOZ/gitlab-live) -Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ce/api/README.html). -As of version `4.0.0` this gem will only support Ruby 2.0+ and Gitlab API v4. +Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ce/api/README.html). +As of version `4.0.0` this gem only supports Ruby 2.0+ and Gitlab API v4. ## Installation @@ -26,6 +26,12 @@ ```ruby gem 'gitlab' # gem 'gitlab', github: 'NARKOZ/gitlab' +``` + +Mac OS users can install using Homebrew: + +```sh +brew install gitlab-gem ``` ## Usage @@ -175,6 +181,64 @@ ## Development +### With a dockerized Gitlab instance + +```shell +docker-compose up -d gitlab # Will start the gitlab instance in the background (approx. 3 minutes) +``` + +After a while, your Gitlab instance will be accessible on http://localhost:3000. + +Once you have set your new root password, you can login with the root user. + +You can now setup a personal access token here: http://localhost:3000/profile/personal_access_tokens + +Once you have your token, set the variables to the correct values in the `docker.env` file. + +Then, launch the tool: + +```shell +docker-compose run app +``` + +```ruby +Gitlab.users +=> [#1, "name"=>"Administrator", "username"=>"root", ...] +``` + +To launch the specs, + +```shell +docker-compose run app rake spec +``` + +#### Want to use Gitlab Enterprise? + +Just change the image from `gitlab/gitlab-ce:latest` to `gitlab/gitlab-ee:latest` in the `docker-compose.yml` file. + +### With an external Gitlab instance + +First, set the variables to the correct values in the `docker.env` file. + +Then, launch the tool: + +```shell +docker-compose run app +``` + +```ruby +Gitlab.users +=> [#1, "name"=>"Administrator", "username"=>"root", ...] +``` + +To launch the specs, + +```shell +docker-compose run app rake spec +``` + +### Without Docker + After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. diff --git a/Rakefile b/Rakefile index 849ce04..7f078a0 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,17 @@ -require "bundler/gem_tasks" +require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |spec| - spec.pattern = FileList['spec/**/*_spec.rb'] spec.rspec_opts = ['--color', '--format d'] end -task default: :spec +require 'rubocop/rake_task' +RuboCop::RakeTask.new(:rubocop) do |task| + task.options = ['-D', '--parallel'] +end + +if ENV['TRAVIS_CI_RUBOCOP'] + task default: :rubocop +else + task default: :spec +end diff --git a/gitlab.gemspec b/gitlab.gemspec index 7700c83..0da77b8 100644 --- a/gitlab.gemspec +++ b/gitlab.gemspec @@ -1,31 +1,33 @@ -# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'gitlab/version' Gem::Specification.new do |gem| - gem.name = "gitlab" + gem.name = 'gitlab' gem.version = Gitlab::VERSION - gem.authors = ["Nihad Abbasov"] - gem.email = ["mail@narkoz.me"] - gem.description = %q{Ruby client and CLI for GitLab API} - gem.summary = %q{A Ruby wrapper and CLI for the GitLab API} - gem.homepage = "https://github.com/narkoz/gitlab" + gem.authors = ['Nihad Abbasov', 'Sean Edge'] + gem.email = ['mail@narkoz.me', 'asedge@gmail.com'] + gem.description = 'Ruby client and CLI for GitLab API' + gem.summary = 'A Ruby wrapper and CLI for the GitLab API' + gem.homepage = 'https://github.com/narkoz/gitlab' - gem.files = `git ls-files`.split($/) - gem.bindir = "exe" + gem.files = `git ls-files`.split($/). + reject { |f| f[/^spec/] } - + %w[Dockerfile docker-compose.yml docker.env .travis.yml .rubocop.yml .dockerignore] + gem.bindir = 'exe' gem.executables = gem.files.grep(%r{^exe/}) { |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) - gem.require_paths = ["lib"] - gem.license = "BSD" + gem.require_paths = ['lib'] + gem.license = 'BSD' - gem.required_ruby_version = ">= 2.0.0" + gem.required_ruby_version = '>= 2.0.0' - gem.add_runtime_dependency 'httparty' - gem.add_runtime_dependency 'terminal-table' + gem.add_runtime_dependency 'httparty', '>= 0.14.0' + gem.add_runtime_dependency 'terminal-table', '>= 1.5.1' gem.add_development_dependency 'pry' gem.add_development_dependency 'rake' gem.add_development_dependency 'rspec' gem.add_development_dependency 'webmock' + gem.add_development_dependency 'rubocop' end diff --git a/lib/gitlab/api.rb b/lib/gitlab/api.rb index f04a56f..af78c5f 100644 --- a/lib/gitlab/api.rb +++ b/lib/gitlab/api.rb @@ -13,7 +13,8 @@ (Configuration::VALID_OPTIONS_KEYS + [:auth_token]).each do |key| send("#{key}=", options[key]) if options[key] end - set_request_defaults(@sudo) + request_defaults(@sudo) + self.class.headers 'User-Agent' => user_agent end end end diff --git a/lib/gitlab/cli.rb b/lib/gitlab/cli.rb index e20607b..cf10150 100644 --- a/lib/gitlab/cli.rb +++ b/lib/gitlab/cli.rb @@ -52,15 +52,11 @@ end unless valid_command?(cmd) - puts "Unknown command. Run `gitlab help` for a list of available commands." + puts 'Unknown command. Run `gitlab help` for a list of available commands.' exit(1) end - if args.any? && (args.last.start_with?('--only=') || args.last.start_with?('--except=')) - command_args = args[0..-2] - else - command_args = args - end + command_args = args.any? && args.last.start_with?('--only=', '--except=') ? args[0..-2] : args begin command_args.map! { |arg| symbolize_keys(yaml_load(arg)) } diff --git a/lib/gitlab/cli_helpers.rb b/lib/gitlab/cli_helpers.rb index 1b69e6f..69893ec 100644 --- a/lib/gitlab/cli_helpers.rb +++ b/lib/gitlab/cli_helpers.rb @@ -67,14 +67,15 @@ # # @return [String] def confirm_command(cmd) - if cmd.start_with?('remove_') || cmd.start_with?('delete_') - puts "Are you sure? (y/n)" - if %w(y yes).include?($stdin.gets.to_s.strip.downcase) - puts 'Proceeding..' - else - puts 'Command aborted.' - exit(1) - end + return unless cmd.start_with?('remove_', 'delete_') + + puts 'Are you sure? (y/n)' + + if %w(y yes).include?($stdin.gets.to_s.strip.downcase) + puts 'Proceeding..' + else + puts 'Command aborted.' + exit(1) end end @@ -102,17 +103,17 @@ end def output_json(cmd, args, data) - if data.empty? + if data.respond_to?(:empty?) && data.empty? puts '{}' else hash_result = case data - when Gitlab::ObjectifiedHash,Gitlab::FileResponse + when Gitlab::ObjectifiedHash, Gitlab::FileResponse record_hash([data], cmd, args, true) when Gitlab::PaginatedResponse record_hash(data, cmd, args) else { cmd: cmd, data: data, args: args } - end + end puts JSON.pretty_generate(hash_result) end end @@ -135,7 +136,7 @@ keys.each do |key| case value = hash[key] when Hash - value = value.has_key?('id') ? value['id'] : 'Hash' + value = value.key?('id') ? value['id'] : 'Hash' when StringIO value = 'File' when nil @@ -194,7 +195,7 @@ # Helper function to get rows and keys from data returned from API call def get_keys(args, data) arr = data.map(&:to_h) - keys = arr.first.keys.sort { |x, y| x.to_s <=> y.to_s } + keys = arr.first.keys.sort_by(&:to_s) keys &= required_fields(args) if required_fields(args).any? keys -= excluded_fields(args) [arr, keys] @@ -220,7 +221,7 @@ begin newhash[key.to_sym] = symbolize_keys(value) rescue NoMethodError - raise "error: cannot convert hash key to symbol: #{key}" + raise "Error: cannot convert hash key to symbol: #{key}" end end end @@ -230,12 +231,9 @@ # YAML::load on a single argument def yaml_load(arg) - begin - yaml = YAML.load(arg) - rescue Psych::SyntaxError - raise "error: Argument is not valid YAML syntax: #{arg}" - end - yaml + YAML.safe_load(arg) + rescue Psych::SyntaxError + raise "Error: Argument is not valid YAML syntax: #{arg}" end end end diff --git a/lib/gitlab/client/access_requests.rb b/lib/gitlab/client/access_requests.rb new file mode 100644 index 0000000..a80a288 --- /dev/null +++ b/lib/gitlab/client/access_requests.rb @@ -0,0 +1,94 @@ +class Gitlab::Client + # Defines methods related to Award Emojis. + # @see https://docs.gitlab.com/ce/api/access_requests.html + module AccessRequests + # Gets a list of access requests for a project viewable by the authenticated user. + # + # @example + # Gitlab.project_access_requests(1) + # + # @param [Integer, String] :project(required) The ID or name of a project. + # @return [Array] List of project access requests + def project_access_requests(project) + get("/projects/#{url_encode project}/access_requests") + end + # Gets a list of access requests for a group viewable by the authenticated user. + # + # @example + # Gitlab.group_access_requests(1) + # + # @param [Integer, String] :group(required) The ID or name of a group. + # @return [Array] List of group access requests + def group_access_requests(group) + get("/groups/#{url_encode group}/access_requests") + end + # Requests access for the authenticated user to a project. + # + # @example + # Gitlab.request_project_access(1) + # + # @param [Integer, String] :project(required) The ID or name of a project. + # @return = 6.8.x # # @example - # Gitlab.create_branch(3, 'api') - # Gitlab.repo_create_branch(5, 'master') + # Gitlab.create_branch(3, 'api', 'feat/new-api') + # Gitlab.repo_create_branch(5, 'master', 'develop') # # @param [Integer, String] project The ID or name of a project. # @param [String] branch The name of the new branch. # @param [String] ref Create branch from commit sha or existing branch # @return [Gitlab::ObjectifiedHash] Details about the branch def create_branch(project, branch, ref) - post("/projects/#{url_encode project}/repository/branches", body: { branch: branch, ref: ref }) + post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref }) end alias_method :repo_create_branch, :create_branch @@ -89,7 +89,7 @@ # @param [Integer, String] project The ID or name of a project. # @param [String] branch The name of the branch to delete def delete_branch(project, branch) - delete("/projects/#{url_encode project}/repository/branches/#{branch}") + delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}") end alias_method :repo_delete_branch, :delete_branch end diff --git a/lib/gitlab/client/build_variables.rb b/lib/gitlab/client/build_variables.rb index c07fa13..573a559 100644 --- a/lib/gitlab/client/build_variables.rb +++ b/lib/gitlab/client/build_variables.rb @@ -1,6 +1,7 @@ class Gitlab::Client # Defines methods related to builds. # @see https://docs.gitlab.com/ce/api/build_variables.html + # @see https://docs.gitlab.com/ee/api/group_level_variables.html module BuildVariables # Gets a list of the project's build variables # @@ -16,7 +17,7 @@ # Gets details of a project's specific build variable. # # @example - # Gitlab.build(5, "TEST_VARIABLE_1") + # Gitlab.variable(5, "TEST_VARIABLE_1") # # @param [Integer, String] project The ID or name of a project. # @param [String] key The key of a variable. @@ -41,7 +42,7 @@ # Update a project's build variable. # # @example - # Gitlab.create_variable(5, "NEW_VARIABLE", "updated value") + # Gitlab.update_variable(5, "NEW_VARIABLE", "updated value") # # @param [Integer, String] project The ID or name of a project. # @param [String] key The key of a variable @@ -62,5 +63,66 @@ def remove_variable(project, key) delete("/projects/#{url_encode project}/variables/#{key}") end + + # Gets a list of the group's build variables + # + # @example + # Gitlab.group_variables(5) + # + # @param [Integer, String] group The ID or name of a group. + # @return [Array] The list of variables. + def group_variables(group) + get("/groups/#{url_encode group}/variables") + end + + # Gets details of a group's specific build variable. + # + # @example + # Gitlab.group_variable(5, "TEST_VARIABLE_1") + # + # @param [Integer, String] group The ID or name of a group. + # @param [String] key The key of a variable. + # @return [Gitlab::ObjectifiedHash] The variable. + def group_variable(group, key) + get("/groups/#{url_encode group}/variables/#{key}") + end + + # Create a build variable for a group. + # + # @example + # Gitlab.create_group_variable(5, "NEW_VARIABLE", "new value") + # + # @param [Integer, String] group The ID or name of a group. + # @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 + # @param [String] value The value of a variable + # @return [Gitlab::ObjectifiedHash] The variable. + def create_group_variable(group, key, value) + post("/groups/#{url_encode group}/variables", body: { key: key, value: value }) + end + + # Update a group's build variable. + # + # @example + # Gitlab.update_group_variable(5, "NEW_VARIABLE", "updated value") + # + # @param [Integer, String] group The ID or name of a group. + # @param [String] key The key of a variable + # @param [String] value The value of a variable + # @return [Gitlab::ObjectifiedHash] The variable. + def update_group_variable(group, key, value) + put("/groups/#{url_encode group}/variables/#{key}", body: { value: value }) + end + + # Remove a group's build variable. + # + # @example + # Gitlab.remove_group_variable(5, "VARIABLE_1") + # + # @param [Integer, String] group The ID or name of a group. + # @param [String] key The key of a variable. + # @return [Gitlab::ObjectifiedHash] The variable. + def remove_group_variable(group, key) + delete("/groups/#{url_encode group}/variables/#{key}") + end end end diff --git a/lib/gitlab/client/commits.rb b/lib/gitlab/client/commits.rb index 367c6f2..a86a2e1 100644 --- a/lib/gitlab/client/commits.rb +++ b/lib/gitlab/client/commits.rb @@ -142,5 +142,23 @@ }.merge(options) post("/projects/#{url_encode project}/repository/commits", body: payload) end + + # Gets a list of merge requests for a commit. + # + # @see https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit + # Introduced in Gitlab 10.7 + # + # @example + # Gitlab.commit_merge_requests(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b') + # + # @param [Integer] project The ID of a project. + # @param [String] sha The commit hash. + # @option options [Integer] :page The page number. + # @option options [Integer] :per_page The number of results per page. + # @return [Array] + def commit_merge_requests(project, commit, options={}) + get("/projects/#{url_encode project}/repository/commits/#{commit}/merge_requests", query: options) + end + alias_method :repo_commit_merge_requests, :commit_merge_requests end end diff --git a/lib/gitlab/client/deployments.rb b/lib/gitlab/client/deployments.rb new file mode 100644 index 0000000..7b1791d --- /dev/null +++ b/lib/gitlab/client/deployments.rb @@ -0,0 +1,32 @@ +class Gitlab::Client + # Defines methods related to deployments. + # @see https://docs.gitlab.com/ce/api/deployments.html + module Deployments + # Gets a list of project deployments. + # + # @example + # Gitlab.deployments(5) + # Gitlab.deployments(5, { per_page: 10, page: 2 }) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Hash] options A customizable set of options. + # @option options [Integer] :page The page number. + # @option options [Integer] :per_page The number of results per page. + # @return [Array] + def deployments(project, options={}) + get("/projects/#{url_encode project}/deployments", query: options) + end + + # Gets a single deployment. + # + # @example + # Gitlab.deployment(5, 36) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of an deployment. + # @return [Gitlab::ObjectifiedHash] + def deployment(project, id) + get("/projects/#{url_encode project}/deployments/#{id}") + end + end +end diff --git a/lib/gitlab/client/events.rb b/lib/gitlab/client/events.rb new file mode 100644 index 0000000..8d92aa7 --- /dev/null +++ b/lib/gitlab/client/events.rb @@ -0,0 +1,58 @@ +class Gitlab::Client + # Defines methods related to events. + # @see https://docs.gitlab.com/ce/api/events.html + module Events + # Gets a list of authenticated user's events + # + # @example + # Gitlab.events() + # Gitlab.events({ action: 'created', target_type: 'issue' }) + # + # @param [Hash] options A customizable set of options. + # @option options [String] :action Only events of specific action type + # @option options [String] :target_type Only events of specific target type + # @option options [String] :before Only events created before YYYY-MM-DD + # @option options [String] :after Only events created after YYYY-MM-DD + # @option options [String] :sort Sort by created_at either 'asc' or 'desc' + # @return [Array] + def events(options={}) + get('/events', query: options) + end + + # Gets a list of user contribution events + # + # @example + # Gitlab.user_events(1) + # Gitlab.user_events(1, { action: created}) + # + # @param [Integer, String] user The ID or username of user + # @param [Hash] options A customizable set of options. + # @option options [String] :action Only events of specific action type + # @option options [String] :target_type Only events of specific target type + # @option options [String] :before Only events created before YYYY-MM-DD + # @option options [String] :after Only events created after YYYY-MM-DD + # @option options [String] :sort Sort by created_at either 'asc' or 'desc' + # @return [Array] + def user_events(user, options={}) + get("/users/#{url_encode user}/events", query: options) + end + + # Gets a list of visible project events + # + # @example + # Gitlab.project_events(1) + # Gitlab.project_events(1, { action: created }) + # + # @param [Integer] project The ID of project + # @param [Hash] options A customizable set of options. + # @option options [String] :action Only events of specific action type + # @option options [String] :target_type Only events of specific target type + # @option options [String] :before Only events created before YYYY-MM-DD + # @option options [String] :after Only events created after YYYY-MM-DD + # @option options [String] :sort Sort by created_at either 'asc' or 'desc' + # @return [Array] + def project_events(project, options={}) + get("/#{url_encode project}/events", query: options) + end + end +end diff --git a/lib/gitlab/client/group_milestones.rb b/lib/gitlab/client/group_milestones.rb new file mode 100644 index 0000000..5825c7f --- /dev/null +++ b/lib/gitlab/client/group_milestones.rb @@ -0,0 +1,93 @@ +class Gitlab::Client + # Defines methods related to group milestones. + # @see https://docs.gitlab.com/ee/api/group_milestones.html + module GroupMilestones + # Gets a list of a group's milestones. + # + # @example + # Gitlab.group_milestones(5) + # + # @param [Integer, String] id The ID or name of a group. + # @param [Hash] options A customizable set of options. + # @option options [Integer] :page The page number. + # @option options [Integer] :per_page The number of results per page. + # @return [Array] + def group_milestones(id, options={}) + get("/groups/#{url_encode id}/milestones", query: options) + end + + # Gets a single group milestone. + # + # @example + # Gitlab.group_milestone(5, 36) + # + # @param [Integer, String] id The ID or name of a group. + # @param [Integer] milestone_id The ID of a milestone. + # @return [Gitlab::ObjectifiedHash] + def group_milestone(id, milestone_id) + get("/groups/#{url_encode id}/milestones/#{milestone_id}") + end + + # Creates a new group milestone. + # + # @example + # Gitlab.create_group_milestone(5, 'v1.0') + # + # @param [Integer, String] id The ID or name of a group. + # @param [String] title The title of a milestone. + # @param [Hash] options A customizable set of options. + # @option options [String] :description The description of a milestone. + # @option options [String] :due_date The due date of a milestone. + # @return [Gitlab::ObjectifiedHash] Information about created milestone. + def create_group_milestone(id, title, options={}) + body = { title: title }.merge(options) + post("/groups/#{url_encode id}/milestones", body: body) + end + + # Updates a group milestone. + # + # @example + # Gitlab.edit_group_milestone(5, 2, { state_event: 'activate' }) + # + # @param [Integer, String] id The ID or name of a group. + # @param [Integer] milestone_id The ID of a milestone. + # @param [Hash] options A customizable set of options. + # @option options [String] :title The title of a milestone. + # @option options [String] :description The description of a milestone. + # @option options [String] :due_date The due date of a milestone. + # @option options [String] :state_event The state of a milestone ('close' or 'activate'). + # @return [Gitlab::ObjectifiedHash] Information about updated milestone. + def edit_group_milestone(id, milestone_id, options={}) + put("/groups/#{url_encode id}/milestones/#{milestone_id}", body: options) + end + + # Gets the issues of a given group milestone. + # + # @example + # Gitlab.group_milestone_issues(5, 2) + # + # @param [Integer, String] id The ID or name of a group. + # @param [Integer, String] milestone_id The ID of a milestone. + # @option options [Integer] :page The page number. + # @option options [Integer] :per_page The number of results per page. + # @return [Array] + def group_milestone_issues(id, milestone_id, options={}) + get("/groups/#{url_encode id}/milestones/#{milestone_id}/issues", query: options) + end + + # Gets the merge_requests of a given group milestone. + # + # @example + # Gitlab.group_milestone_merge_requests(5, 2) + # + # @param [Integer, String] group The ID or name of a group. + # @param [Integer, String] milestone_id The ID of a milestone. + # @option options [Integer] :page The page number. + # @option options [Integer] :per_page The number of results per page. + # @return [Array] + def group_milestone_merge_requests(id, milestone_id, options={}) + get("/groups/#{url_encode id}/milestones/#{milestone_id}/merge_requests", query: options) + end + end +end + diff --git a/lib/gitlab/client/groups.rb b/lib/gitlab/client/groups.rb index dc9459c..490a02e 100644 --- a/lib/gitlab/client/groups.rb +++ b/lib/gitlab/client/groups.rb @@ -24,7 +24,7 @@ # @param [Integer] id The ID of a group. # @return [Gitlab::ObjectifiedHash] def group(id) - get("/groups/#{id}") + get("/groups/#{url_encode id}") end # Creates a new group. @@ -48,7 +48,7 @@ # @param [Integer] id The ID of a group # @return [Gitlab::ObjectifiedHash] Information about the deleted group. def delete_group(id) - delete("/groups/#{id}") + delete("/groups/#{url_encode id}") end # Get a list of group members. @@ -63,7 +63,19 @@ # @option options [Integer] :per_page The number of results per page. # @return [Array] def group_members(id, options={}) - get("/groups/#{id}/members", query: options) + get("/groups/#{url_encode id}/members", query: options) + end + + # Get details of a single group member. + # + # @example + # Gitlab.group_member(1, 10) + # + # @param [Integer] team_id The ID of the group to find a member in. + # @param [Integer] user_id The user id of the member to find. + # @return [Gitlab::ObjectifiedHash] (id, username, name, email, state, access_level ...) + def group_member(team_id, user_id) + get("/groups/#{url_encode team_id}/members/#{user_id}") end # Adds a user to group. @@ -76,7 +88,7 @@ # @param [Integer] access_level Project access level. # @return [Gitlab::ObjectifiedHash] Information about added team member. def add_group_member(team_id, user_id, access_level) - post("/groups/#{team_id}/members", body: { user_id: user_id, access_level: access_level }) + post("/groups/#{url_encode team_id}/members", body: { user_id: user_id, access_level: access_level }) end # Edit a user of a group. @@ -89,7 +101,7 @@ # @param [Integer] access_level Project access level. # @return [Gitlab::ObjectifiedHash] Information about edited team member. def edit_group_member(team_id, user_id, access_level) - put("/groups/#{team_id}/members/#{user_id}", body: { access_level: access_level }) + put("/groups/#{url_encode team_id}/members/#{user_id}", body: { access_level: access_level }) end # Removes user from user group. @@ -101,7 +113,7 @@ # @param [Integer] user_id The ID of a user. # @return [Gitlab::ObjectifiedHash] Information about removed team member. def remove_group_member(team_id, user_id) - delete("/groups/#{team_id}/members/#{user_id}") + delete("/groups/#{url_encode team_id}/members/#{user_id}") end # Transfers a project to a group @@ -113,7 +125,7 @@ # @param [Integer] project_id The ID of a project. def transfer_project_to_group(id, project_id) body = { id: id, project_id: project_id } - post("/groups/#{id}/projects/#{project_id}", body: body) + post("/groups/#{url_encode id}/projects/#{project_id}", body: body) end # Search for groups by name @@ -138,7 +150,44 @@ # @param [Integer] id The ID of a group # @return [Array] List of projects under a group def group_projects(id, options={}) - get("/groups/#{id}/projects", query: options) + get("/groups/#{url_encode id}/projects", query: options) + end + + # Get a list of subgroups under a group + # @example + # Gitlab.group_subgroups(1) + # + # @param [Integer] id the ID of a group + # @param [Hash] options A customizable set of options. + # @option options [String] :skip_groups Skip the group IDs passed. + # @option options [String] :all_available Show all the groups you have access to (defaults to false for authenticated users). + # @option options [String] :search Return the list of authorized groups matching the search criteria. + # @option options [String] :order_by Order groups by name or path. Default is name. + # @option options [String] :sort Order groups in asc or desc order. Default is asc. + # @option options [String] :statistics Include group statistics (admins only). + # @option options [String] :owned Limit to groups owned by the current user. + # @return [Array] List of subgroups under a group + def group_subgroups(id, options={}) + get("/groups/#{url_encode id}/subgroups", query: options) + end + + # Updates an existing group. + # + # @example + # Gitlab.edit_group(42) + # Gitlab.edit_group(42, { name: 'Group Name' }) + # + # @param [Integer] group The ID. + # @param [Hash] options A customizable set of options + # @option options [String] :name The name of the group. + # @option options [String] :path The path of the group. + # @option options [String] :description The description of the group. + # @option options [String] :visibility The visibility level of the group. Can be private, internal, or public + # @option options [String] :lfs_enabled Enable/disable Large File Storage (LFS) for the projects in this groupr. + # @option options [String] :request_access_enabled Allow users to request member access. + # @return [Gitlab::ObjectifiedHash] Information about the edited group. + def edit_group(id, options={}) + put("/groups/#{url_encode id}", body: options) end end end diff --git a/lib/gitlab/client/issues.rb b/lib/gitlab/client/issues.rb index a039287..2f1deda 100644 --- a/lib/gitlab/client/issues.rb +++ b/lib/gitlab/client/issues.rb @@ -133,5 +133,76 @@ def delete_issue(project, id) delete("/projects/#{url_encode project}/issues/#{id}") end + + # Move an issue. + # + # @example + # Gitlab.move_issue(3, 42, { to_project_id: '4' }) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of an issue. + # @option options [String] :to_project_id The ID of the new project. + # @return [Gitlab::ObjectifiedHash] Information about moved issue. + def move_issue(project, id, options={}) + post("/projects/#{url_encode project}/issues/#{id}/move", body: options) + end + + # Sets an estimated time of work for an issue. + # + # @example + # Gitlab.estimate_time_of_issue(3, 42, '3h30m') + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of an issue. + # @param [String] duration The duration in human format. e.g: 3h30m + def estimate_time_of_issue(project, id, duration) + post("/projects/#{url_encode project}/issues/#{id}/time_estimate", body: { duration: url_encode(duration) }) + end + + # Resets the estimated time for an issue to 0 seconds. + # + # @example + # Gitlab.reset_time_estimate_of_issue(3, 42) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of an issue. + def reset_time_estimate_of_issue(project, id) + post("/projects/#{url_encode project}/issues/#{id}/reset_time_estimate") + end + + # Adds spent time for an issue + # + # @example + # Gitlab.estimate_time_of_issue(3, 42, '3h30m') + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of an issue. + # @param [String] duration The time spent in human format. e.g: 3h30m + def add_time_spent_on_issue(project, id, duration) + post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: url_encode(duration) }) + end + + # Resets the total spent time for this issue to 0 seconds. + # + # @example + # Gitlab.reset_time_spent_on_issue(3, 42) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of an issue. + def reset_time_spent_on_issue(project, id) + post("/projects/#{url_encode project}/issues/#{id}/reset_spent_time") + end + + # Get time tracking stats for an issue + # + # @example + # @gitlab.time_stats_for_issue(3, 42) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of an issue. + def time_stats_for_issue(project, id) + get("/projects/#{url_encode project}/issues/#{id}/time_stats") + end + end end diff --git a/lib/gitlab/client/labels.rb b/lib/gitlab/client/labels.rb index 2d82301..6f35f44 100644 --- a/lib/gitlab/client/labels.rb +++ b/lib/gitlab/client/labels.rb @@ -9,8 +9,8 @@ # # @param [Integer, String] project The ID or name of a project. # @return [Array] - def labels(project) - get("/projects/#{url_encode project}/labels") + def labels(project, options={}) + get("/projects/#{url_encode project}/labels", query: options) end # Creates a new label. diff --git a/lib/gitlab/client/merge_request_approvals.rb b/lib/gitlab/client/merge_request_approvals.rb new file mode 100644 index 0000000..36ea9b8 --- /dev/null +++ b/lib/gitlab/client/merge_request_approvals.rb @@ -0,0 +1,110 @@ +class Gitlab::Client + # Defines methods related to MR Approvals. + # @see https://docs.gitlab.com/ee/api/merge_request_approvals.html + module MergeRequestApprovals + # Gets MR Approval Configuration for a project + # + # @example + # Gitlab.project_merge_request_approvals(1) + # + # @param [Integer] project The ID of a project. + # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project + def project_merge_request_approvals(project) + get("/projects/#{url_encode project}/approvals") + end + + # Change MR Approval Configuration for a project + # + # @example + # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3}) + # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, reset_approvals_on_push: true}) + # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, disable_overriding_approvers_per_merge_request: false}) + # + # @param [Integer] project(required) The ID of a project. + # @option options [Integer] :approvals_before_merge(optional) How many approvals are required before an MR can be merged + # @option options [Boolean] :reset_approvals_on_push(optional) Reset approvals on a new push + # @option options [Boolean] :disable_overriding_approvers_per_merge_request(optional) Allow/Disallow overriding approvers per MR + # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project + def edit_project_merge_request_approvals(project, options = {}) + post("/projects/#{url_encode project}/approvals", body: options) + end + + # Change allowed approvers and approver groups for a project + # + # @example + # Gitlab.edit_project_approvers(1, {approver_ids: [5], approver_groups: [1]}) + # + # @param [Integer] project(required) The ID of a project. + # @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs + # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs + # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project + def edit_project_approvers(project, options = {}) + put("/projects/#{url_encode project}/approvals", body: options) + end + + # Get Configuration for approvals on a specific Merge Request. + # + # @example + # Gitlab.merge_request_approvals(1, 5) + # + # @param [Integer] project(required) The ID of a project. + # @param [Integer] merge_request(required) The IID of a merge_request. + # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the merge request + def merge_request_approvals(project, merge_request) + get("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals") + end + + # Change configuration for approvals on a specific merge request. + # + # @example + # Gitlab.edit_merge_request_approvals(1, 5, approvals_required: 2) + # + # @param [Integer] project(required) The ID of a project. + # @param [Integer] merge_request(required) The IID of a merge_request. + # @option options [Integer] :approvals_required(required) Approvals required before MR can be merged + # @return [Gitlab::ObjectifiedHash] Updated MR approval configuration information about the merge request + def edit_merge_request_approvals(project, merge_request, options = {}) + post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options) + end + + # Change allowed approvers and approver groups for a merge request + # + # @example + # Gitlab.edit_merge_request_approvers(1, 5, {approver_ids: [5], approver_groups: [1]}) + # + # @param [Integer] project(required) The ID of a project. + # @param [Integer] merge_request(required) The IID of a merge_request. + # @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs + # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs + # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project + def edit_merge_request_approvers(project, merge_request, options = {}) + put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options) + end + + # Approve a merge request + # + # @example + # Gitlab.approve_merge_request(1, 5) + # Gitlab.approve_merge_request(1, 5, sha: 'fe678da') + # + # @param [Integer] project(required) The ID of a project. + # @param [Integer] merge_request(required) The IID of a merge request. + # @option options [String] :sha(optional) The HEAD of the MR + # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project + def approve_merge_request(project, merge_request, options = {}) + post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approve", body: options) + end + + # Unapprove a merge request + # + # @example + # Gitlab.unapprove_merge_request(1, 5) + # + # @param [Integer] project(required) The ID of a project. + # @param [Integer] merge_request(required) The IID of a merge request. + # @return [void] This API call returns an empty response body. + def unapprove_merge_request(project, merge_request) + post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove") + end + end +end \ No newline at end of file diff --git a/lib/gitlab/client/merge_requests.rb b/lib/gitlab/client/merge_requests.rb index dd6df91..8e3dbce 100644 --- a/lib/gitlab/client/merge_requests.rb +++ b/lib/gitlab/client/merge_requests.rb @@ -2,11 +2,23 @@ # Defines methods related to merge requests. # @see https://docs.gitlab.com/ce/api/merge_requests.html module MergeRequests + # Gets a list of all of the merge requests the authenticated user has access to. + # + # @example + # Gitlab.user_merge_requests + # Gitlab.user_merge_requests(state: :opened, scope: :all) + # + # @param [Hash] options A customizable set of options. + # @return [Array] + def user_merge_requests(options = {}) + get('/merge_requests', query: options) + end + # Gets a list of project merge requests. # # @example # Gitlab.merge_requests(5) - # Gitlab.merge_requests({ per_page: 40 }) + # Gitlab.merge_requests(5, { per_page: 40 }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. @@ -44,6 +56,7 @@ # @option options [String] :target_branch (required) The target branch name. # @option options [Integer] :assignee_id (optional) The ID of a user to assign merge request. # @option options [Integer] :target_project_id (optional) The target project ID. + # @option options [String] :labels (optional) Labels as a comma-separated list. # @return [Gitlab::ObjectifiedHash] Information about created merge request. def create_merge_request(project, title, options={}) body = { title: title }.merge(options) @@ -142,5 +155,121 @@ def unsubscribe_from_merge_request(project, id) post("/projects/#{url_encode project}/merge_requests/#{id}/unsubscribe") end + + # List project merge request discussions + # + # @example + # Gitlab.merge_request_discussions(5, 1) + # Gitlab.merge_request_discussions('gitlab', 1) + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of a merge request. + # @return [Gitlab::ObjectifiedHash] List of the merge request discussions. + def merge_request_discussions(project, merge_request_id) + get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions") + end + + # Get single merge request discussion + # + # @example + # Gitlab.merge_request_discussion(5, 1, 1) + # Gitlab.merge_request_discussion('gitlab', 1, 1) + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of a merge request. + # @param [Integer] discussion_id The ID of a discussion. + # @return [Gitlab::ObjectifiedHash] The merge request discussion. + def merge_request_discussion(project, merge_request_id, discussion_id) + get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}") + end + + # Create new merge request discussion + # + # @example + # Gitlab.create_merge_request_discussion(5, 1, body: 'discuss') + # Gitlab.create_merge_request_discussion('gitlab', 1, body: 'discuss') + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of a merge request. + # @param [Hash] options A customizable set of options. + # * :body (String) The content of a discussion + # * :created_at (String) Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z + # * :position (Hash) Position when creating a diff note + # * :base_sha (String) Base commit SHA in the source branch + # * :start_sha (String) SHA referencing commit in target branch + # * :head_sha (String) SHA referencing HEAD of this merge request + # * :position_type (String) Type of the position reference', allowed values: 'text' or 'image' + # * :new_path (String) File path after change + # * :new_line (Integer) Line number after change (for 'text' diff notes) + # * :old_path (String) File path before change + # * :old_line (Integer) Line number before change (for 'text' diff notes) + # * :width (Integer) Width of the image (for 'image' diff notes) + # * :height (Integer) Height of the image (for 'image' diff notes) + # * :x (Integer) X coordinate (for 'image' diff notes) + # * :y (Integer) Y coordinate (for 'image' diff notes) + # @return [Gitlab::ObjectifiedHash] The created merge request discussion. + def create_merge_request_discussion(project, merge_request_id, options={}) + post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions", body: options) + end + + # Resolve a merge request discussion + # + # @example + # Gitlab.resolve_merge_request_discussion(5, 1, 1, true) + # Gitlab.resolve_merge_request_discussion('gitlab', 1, 1, false) + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of a merge request. + # @param [Integer] discussion_id The ID of a discussion. + # @param [Hash] options A customizable set of options. + # @option options [Boolean] :resolved Resolve/unresolve the discussion. + # @return [Gitlab::ObjectifiedHash] The merge request discussion. + def resolve_merge_request_discussion(project, merge_request_id, discussion_id, options) + put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}", body: options) + end + + # Add note to existing merge request discussion + # + # @example + # Gitlab.create_merge_request_discussion_note(5, 1, 1, note_id: 1, body: 'note') + # Gitlab.create_merge_request_discussion_note('gitlab', 1, 1, note_id: 1, body: 'note') + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of a merge request. + # @param [Integer] discussion_id The ID of a discussion. + # @param [Hash] options A customizable set of options. + # @option options [Integer] :note_id The ID of a discussion note. + # @option options [String] :body The content of a discussion. + # @option options [String] :created_at Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z. + # @return [Gitlab::ObjectifiedHash] The merge request discussion note. + def create_merge_request_discussion_note(project, merge_request_id, discussion_id, options) + post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes", body: options) + end + + # Modify an existing merge request discussion note + # + # @example + # Gitlab.update_merge_request_discussion_note(5, 1, 1, 1, body: 'note') + # Gitlab.update_merge_request_discussion_note('gitlab', 1, 1, 1, body: 'note') + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of a merge request. + # @param [Integer] discussion_id The ID of a discussion. + # @param [Integer] note_id The ID of a discussion note. + # @param [Hash] options A customizable set of options. + # @option options [String] :body The content of a discussion. + # @option options [Boolean] :resolved Resolve/unresolve the note. + # @return [Gitlab::ObjectifiedHash] The merge request discussion note. + def update_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id, options) + put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}", body: options) + end + + # Delete a merge request discussion note + # + # @example + # Gitlab.delete_merge_request_discussion_note(5, 1, 1, 1) + # Gitlab.delete_merge_request_discussion_note('gitlab', 1, 1, 1) + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of a merge request. + # @param [Integer] discussion_id The ID of a discussion. + # @param [Integer] note_id The ID of a discussion note. + # @return [Gitlab::ObjectifiedHash] An empty response. + def delete_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id) + delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}") + end end end diff --git a/lib/gitlab/client/notes.rb b/lib/gitlab/client/notes.rb index 529fc79..68c99be 100644 --- a/lib/gitlab/client/notes.rb +++ b/lib/gitlab/client/notes.rb @@ -219,9 +219,10 @@ # # @param [Integer] project The ID of a project. # @param [Integer] id The ID of a note. + # @param [String] body The content of a note. # @return [Gitlab::ObjectifiedHash] def edit_note(project, id, body) - put("/projects/#{url_encode project}/notes/#{id}", body: body) + put("/projects/#{url_encode project}/notes/#{id}", body: note_content(body)) end # Modifies an issue note. @@ -232,9 +233,10 @@ # @param [Integer] project The ID of a project. # @param [Integer] issue The ID of an issue. # @param [Integer] id The ID of a note. + # @param [String] body The content of a note. # @return [Gitlab::ObjectifiedHash] def edit_issue_note(project, issue, id, body) - put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: body) + put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: note_content(body)) end # Modifies a snippet note. @@ -245,9 +247,10 @@ # @param [Integer] project The ID of a project. # @param [Integer] snippet The ID of a snippet. # @param [Integer] id The ID of a note. + # @param [String] body The content of a note. # @return [Gitlab::ObjectifiedHash] def edit_snippet_note(project, snippet, id, body) - put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: body) + put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: note_content(body)) end # Modifies a merge_request note. @@ -258,10 +261,24 @@ # @param [Integer] project The ID of a project. # @param [Integer] merge_request The ID of a merge_request. # @param [Integer] id The ID of a note. + # @param [String] body The content of a note. # @return [Gitlab::ObjectifiedHash] def edit_merge_request_note(project, merge_request, id, body) - put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: body) + put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: note_content(body)) end alias_method :edit_merge_request_comment, :edit_merge_request_note + + private + + # TODO: Remove this method after a couple deprecation cycles. Replace calls with the code + # in the 'else'. + def note_content(body) + if body.is_a?(Hash) + STDERR.puts "Passing the note body as a Hash is deprecated. You should just pass the String." + body + else + { body: body } + end + end end end diff --git a/lib/gitlab/client/pipeline_schedules.rb b/lib/gitlab/client/pipeline_schedules.rb new file mode 100644 index 0000000..d212be8 --- /dev/null +++ b/lib/gitlab/client/pipeline_schedules.rb @@ -0,0 +1,133 @@ +class Gitlab::Client + # Defines methods related to pipeline schedules. + # @see https://docs.gitlab.com/ce/api/pipeline_schedules.html + module PipelineSchedules + # Gets a list of project pipeline schedules. + # + # @example + # Gitlab.pipeline_schedules(5) + # Gitlab.pipeline_schedules(5, { scope: 'active' }) + # + # @param [Integer, String] project the ID or name of a project. + # @param [Hash] options A customizable set of options. + # @options options [String] :scope The scope of pipeline schedules, one of a 'active' or 'inactive'. + # @return [Array] + def pipeline_schedules(project, options={}) + get("/projects/#{url_encode project}/pipeline_schedules", query: options) + end + + # Gets a single pipeline schedule. + # + # @example + # Gitlab.pipeline_schedule(5, 3) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] id The ID of the pipeline schedule. + # @return [Gitlab::ObjectifiedHash] + def pipeline_schedule(project, id) + get("/projects/#{url_encode project}/pipeline_schedules/#{id}") + end + + # Create a pipeline schedule. + # + # @example + # Gitlab.create_pipeline_schedule(5, { description: 'example' }) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Hash] options A customizable set of options. + # @option options [String] :description The description of pipeline scehdule. + # @option options [String] :ref The branch/tag name will be triggered. + # @option options [String] :cron The cron (e.g. 0 1 * * *). + # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC'). + # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true). + # @return [Array] + def create_pipeline_schedule(project, options={}) + post("/projects/#{url_encode project}/pipeline_schedules", query: options) + end + + # Updates the pipeline schedule of a project. + # + # @example + # Gitlab.edit_pipeline_schedule(3, 2, { description: 'example2' }) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] The pipeline schedule ID. + # @param [Hash] options A customizable set of options. + # @option options [String] :description The description of pipeline scehdule. + # @option options [String] :ref The branch/tag name will be triggered. + # @option options [String] :cron The cron (e.g. 0 1 * * *). + # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC'). + # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true). + # @return [Array] The updated pipeline schedule. + def edit_pipeline_schedule(project, pipeline_schedule_id, options={}) + put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}", query: options) + end + + # Take ownership of a pipeline schedule. + # + # @example + # Gitlab.pipeline_schedule_take_ownership(5, 1) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] trigger_id The pipeline schedule ID. + # @return [Gitlab::ObjectifiedHash] The updated pipeline schedule. + def pipeline_schedule_take_ownership(project, pipeline_schedule_id) + post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/take_ownership") + end + + # Delete a pipeline schedule. + # + # @example + # Gitlab.delete_pipeline_schedule(5, 1) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] trigger_id The pipeline schedule ID. + # @return [Gitlab::ObjectifiedHash] The deleted pipeline schedule. + def delete_pipeline_schedule(project, pipeline_schedule_id) + delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}") + end + + # Create a pipeline schedule variable. + # + # @example + # Gitlab.create_pipeline_schedule_variable(5, 1, { key: 'foo', value: 'bar' }) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] trigger_id The pipeline schedule ID. + # @param [Hash] options A customizable set of options. + # @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. + # @option options [String] :value The value of a variable + # @return [Array] The created pipeline schedule variable. + def create_pipeline_schedule_variable(project, pipeline_schedule_id, options={}) + post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables", query: options) + end + + # Updates the variable of a pipeline schedule. + # + # @example + # Gitlab.edit_pipeline_schedule_variable(3, 2, "foo" { value: 'bar' }) + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] The pipeline schedule ID. + # @param [String] The key of a variable. + # @param [Hash] options A customizable set of options. + # @option options [String] :value The value of a variable. + # @return [Array] The updated pipeline schedule variable. + def edit_pipeline_schedule_variable(project, pipeline_schedule_id, key, options={}) + put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}", query: options) + end + + # Delete the variable of a pipeline schedule + # + # @example + # Gitlab.delete_pipeline_schedule_variable(3, 2, "foo") + # + # @param [Integer, String] project The ID or name of a project. + # @param [Integer] The pipeline schedule ID. + # @param [String] The key of a variable. + # @return [Array] The deleted pipeline schedule variable. + def delete_pipeline_schedule_variable(project, pipeline_schedule_id, key, options={}) + delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}") + end + end +end diff --git a/lib/gitlab/client/pipeline_triggers.rb b/lib/gitlab/client/pipeline_triggers.rb index ce347de..cdb3ba3 100644 --- a/lib/gitlab/client/pipeline_triggers.rb +++ b/lib/gitlab/client/pipeline_triggers.rb @@ -80,8 +80,8 @@ # Run the given project pipeline trigger. # # @example - # Gitlab.trigger_build(5, '7b9148c158980bbd9bcea92c17522d', 'master') - # Gitlab.trigger_build(5, '7b9148c158980bbd9bcea92c17522d', 'master', { variable1: "value", variable2: "value2" }) + # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master') + # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master', { variable1: "value", variable2: "value2" }) # # @see https://docs.gitlab.com/ce/ci/triggers/README.html # diff --git a/lib/gitlab/client/projects.rb b/lib/gitlab/client/projects.rb index 1496ca8..9c062e5 100644 --- a/lib/gitlab/client/projects.rb +++ b/lib/gitlab/client/projects.rb @@ -10,14 +10,11 @@ # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. - # @option options [String] :scope Scope of projects. 'owned' for list of projects owned by the authenticated user, 'all' to get all projects (admin only) + # (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) + # # @return [Array] def projects(options={}) - if options[:scope] - get("/projects/#{options[:scope]}", query: options) - else - get("/projects", query: options) - end + get("/projects", query: options) end # Search for projects by name. @@ -48,21 +45,6 @@ # @return [Gitlab::ObjectifiedHash] def project(id) get("/projects/#{url_encode id}") - end - - # Gets a list of project events. - # - # @example - # Gitlab.project_events(42) - # Gitlab.project_events('gitlab') - # - # @param [Integer, String] project The ID or path of a project. - # @param [Hash] options A customizable set of options. - # @option options [Integer] :page The page number. - # @option options [Integer] :per_page The number of results per page. - # @return [Array] - def project_events(project, options={}) - get("/projects/#{url_encode project}/events", query: options) end # Creates a new project. @@ -298,7 +280,7 @@ # # @param [Integer] id The ID of a project. # @return [Gitlab::ObjectifiedHash] Information about deleted push rule. - def delete_push_rule(id, options={}) + def delete_push_rule(id) delete("/projects/#{url_encode id}/push_rule") end @@ -355,14 +337,15 @@ # Creates a new deploy key. # # @example - # Gitlab.create_deploy_key(42, 'My Key', 'Key contents') + # Gitlab.create_deploy_key(42, 'My Key', 'Key contents', can_push: true) # # @param [Integer, String] project The ID or path of a project. # @param [String] title The title of a deploy key. # @param [String] key The content of a deploy key. + # @param [Hash] options A customizable set of options. # @return [Gitlab::ObjectifiedHash] Information about created deploy key. - def create_deploy_key(project, title, key) - post("/projects/#{url_encode project}/deploy_keys", body: { title: title, key: key }) + def create_deploy_key(project, title, key, options = {}) + post("/projects/#{url_encode project}/deploy_keys", body: { title: title, key: key }.merge(options)) end # Enables a deploy key at the project. @@ -413,6 +396,24 @@ # @return [Gitlab::ObjectifiedHash] Information about the forked project. def create_fork(id, options={}) post("/projects/#{url_encode id}/fork", body: options) + end + + # Get a list of all visible projects across GitLab for the authenticated user. + # When accessed without authentication, only public projects are returned. + # + # Note: This feature was introduced in GitLab 10.1 + # + # @example + # Gitlab.project_forks(42) + # + # @param [Hash] options A customizable set of options. + # @option options [Integer] :page The page number. + # @option options [Integer] :per_page The number of results per page. + # @option options [String] :order_by Return requests ordered by id, name, created_at or last_activity_at fields + # @option options [String] :sort Return requests sorted in asc or desc order + # @return [Array] + def project_forks(id, options={}) + get("/projects/#{url_encode id}/forks", query: options) end # Updates an existing project. @@ -446,6 +447,18 @@ post("/projects/#{url_encode project}/share", body: { group_id: id, group_access: group_access }) end + # Unshare project with group. + # + # @example + # Gitlab.unshare_project_with_group('gitlab', 2) + # + # @param [Integer, String] project The ID or path of a project. + # @param [Integer] id The ID of a group. + # @return [void] This API call returns an empty response body. + def unshare_project_with_group(project, id) + delete("/projects/#{url_encode project}/share/#{id}") + end + # Stars a project. # @see https://docs.gitlab.com/ce/api/projects.html#star-a-project # @@ -471,5 +484,24 @@ def unstar_project(id) delete("/projects/#{url_encode id}/star") end + + # Get a list of visible projects for the given user. + # @see https://docs.gitlab.com/ee/api/projects.html#list-user-projects + # + # @example + # Gitlab.user_projects(1) + # Gitlab.user_projects(1, { order_by: 'last_activity_at' }) + # Gitlab.user_projects('username', { order_by: 'name', sort: 'asc' }) + # + # @param [Integer, String] user_id The ID or username of the user. + # @param [Hash] options A customizable set of options. + # @option options [String] :per_page Number of projects to return per page + # @option options [String] :page The page to retrieve + # @option options [String] :order_by Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields. + # @option options [String] :sort Return projects sorted in asc or desc order. + # @return [Array] + def user_projects(user_id, options={}) + get("/users/#{url_encode user_id}/projects", query: options) + end end end diff --git a/lib/gitlab/client/repository_files.rb b/lib/gitlab/client/repository_files.rb index 187e2e6..b5c1747 100644 --- a/lib/gitlab/client/repository_files.rb +++ b/lib/gitlab/client/repository_files.rb @@ -15,7 +15,6 @@ # @param [String] ref The name of a repository branch or tag or if not given the default branch. # @return [String] def file_contents(project, filepath, ref='master') - ref = URI.encode(ref, /\W/) get "/projects/#{url_encode project}/repository/files/#{url_encode filepath}/raw", query: { ref: ref}, format: nil, @@ -95,7 +94,8 @@ # @option options [String] :author_email Commit author's email address # @return [Gitlab::ObjectifiedHash] def remove_file(project, path, branch, commit_message, options = {}) - delete("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: { + delete("/projects/#{url_encode project}/repository/files/#{url_encode path}", + body: { branch: branch, commit_message: commit_message }.merge(options)) diff --git a/lib/gitlab/client/runners.rb b/lib/gitlab/client/runners.rb index 5e3b46e..176edea 100644 --- a/lib/gitlab/client/runners.rb +++ b/lib/gitlab/client/runners.rb @@ -72,6 +72,17 @@ delete("/runners/#{id}") end + # Gets a list of Jobs for a Runner + # + # @example + # Gitlab.runner_jobs(1) + # + # @param [Integer] id The ID of a runner. + # @return [Array] + def runner_jobs(runner_id) + get("/runners/#{url_encode runner_id}/jobs") + end + # 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. # @see https://docs.gitlab.com/ce/api/runners.html#list-projects-runners # diff --git a/lib/gitlab/client/sidekiq.rb b/lib/gitlab/client/sidekiq.rb new file mode 100644 index 0000000..8c82f86 --- /dev/null +++ b/lib/gitlab/client/sidekiq.rb @@ -0,0 +1,37 @@ +class Gitlab::Client + # Defines methods related to sidekiq metrics. + # @see https://docs.gitlab.com/ce/api/sidekiq_metrics.html + module Sidekiq + # Get the current Queue Metrics + # + # @example + # Gitlab.sidekiq_queue_metrics + def sidekiq_queue_metrics + get('/sidekiq/queue_metrics') + end + + # Get the current Process Metrics + # + # @example + # Gitlab.sidekiq_process_metrics + def sidekiq_process_metrics + get('/sidekiq/process_metrics') + end + + # Get the current Job Statistics + # + # @example + # Gitlab.sidekiq_job_stats + def sidekiq_job_stats + get('/sidekiq/job_stats') + end + + # Get a compound response of all the previously mentioned metrics + # + # @example + # Gitlab.sidekiq_compound_metrics + def sidekiq_compound_metrics + get('/sidekiq/compound_metrics') + end + end +end diff --git a/lib/gitlab/client/snippets.rb b/lib/gitlab/client/snippets.rb index 50cc9f9..7ae33e4 100644 --- a/lib/gitlab/client/snippets.rb +++ b/lib/gitlab/client/snippets.rb @@ -31,7 +31,7 @@ # Creates a new snippet. # # @example - # Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code' }) + # Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code', visibility: 'public'}) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. @@ -39,6 +39,7 @@ # @option options [String] :file_name (required) The name of a snippet file. # @option options [String] :code (required) The content of a snippet. # @option options [String] :lifetime (optional) The expiration date of a snippet. + # @option options [String] :visibility (required) The visibility of a snippet # @return [Gitlab::ObjectifiedHash] Information about created snippet. def create_snippet(project, options={}) post("/projects/#{url_encode project}/snippets", body: options) @@ -56,6 +57,7 @@ # @option options [String] :file_name The name of a snippet file. # @option options [String] :code The content of a snippet. # @option options [String] :lifetime The expiration date of a snippet. + # @option options [String] :visibility (optional) The visibility of a snippet # @return [Gitlab::ObjectifiedHash] Information about updated snippet. def edit_snippet(project, id, options={}) put("/projects/#{url_encode project}/snippets/#{id}", body: options) diff --git a/lib/gitlab/client/tags.rb b/lib/gitlab/client/tags.rb index 393fccc..faeb719 100644 --- a/lib/gitlab/client/tags.rb +++ b/lib/gitlab/client/tags.rb @@ -30,7 +30,7 @@ # @param [String] description Optional release notes for tag. # @return [Gitlab::ObjectifiedHash] def create_tag(project, tag_name, ref, message='', description=nil) - post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, description: description }) + post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, release_description: description }) end alias_method :repo_create_tag, :create_tag @@ -44,7 +44,7 @@ # @param [String] tag The name of the tag. # @return [Gitlab::ObjectifiedHash] def tag(project, tag) - get("/projects/#{url_encode project}/repository/tags/#{tag}") + get("/projects/#{url_encode project}/repository/tags/#{url_encode tag}") end alias_method :repo_tag, :tag @@ -58,7 +58,7 @@ # @param [String] tag The name of the tag to delete # @return [Gitlab::ObjectifiedHash] def delete_tag(project, tag) - delete("/projects/#{url_encode project}/repository/tags/#{tag}") + delete("/projects/#{url_encode project}/repository/tags/#{url_encode tag}") end alias_method :repo_delete_tag, :delete_tag @@ -73,7 +73,7 @@ # @param [String] description Release notes with markdown support # @return [Gitlab::ObjectifiedHash] def create_release(project, tag, description) - post("/projects/#{url_encode project}/repository/tags/#{tag}/release", body: { description: description }) + post("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description }) end alias_method :repo_create_release, :create_release @@ -88,7 +88,7 @@ # @param [String] description Release notes with markdown support # @return [Gitlab::ObjectifiedHash] def update_release(project, tag, description) - put("/projects/#{url_encode project}/repository/tags/#{tag}/release", body: { description: description }) + put("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description }) end alias_method :repo_update_release, :update_release diff --git a/lib/gitlab/client/users.rb b/lib/gitlab/client/users.rb index 6953f46..f6a3703 100644 --- a/lib/gitlab/client/users.rb +++ b/lib/gitlab/client/users.rb @@ -49,11 +49,11 @@ # @return [Gitlab::ObjectifiedHash] Information about created user. def create_user(*args) options = Hash === args.last ? args.pop : {} - if args[2] - body = { email: args[0], password: args[1], username: args[2] } - else - body = { email: args[0], password: args[1], name: args[0] } - end + body = if args[2] + { email: args[0], password: args[1], username: args[2] } + else + { email: args[0], password: args[1], name: args[0] } + end body.merge!(options) post('/users', body: body) end diff --git a/lib/gitlab/client.rb b/lib/gitlab/client.rb index d46bd40..f6f32dc 100644 --- a/lib/gitlab/client.rb +++ b/lib/gitlab/client.rb @@ -3,34 +3,42 @@ class Client < API Dir[File.expand_path('../client/*.rb', __FILE__)].each { |f| require f } + # Please keep in alphabetical order + include AccessRequests include AwardEmojis include Boards include Branches + include BuildVariables include Builds - include BuildVariables include Commits + include Deployments include Environments + include Events + include GroupMilestones include Groups include Issues + include Jobs include Keys include Labels + include MergeRequestApprovals include MergeRequests include Milestones include Namespaces include Notes + include PipelineSchedules + include PipelineTriggers include Pipelines - include PipelineTriggers include Projects include Repositories include RepositoryFiles include Runners include Services + include Sidekiq include Snippets include SystemHooks include Tags include Todos include Users - include Jobs # Text representation of the client, masking private token. # @@ -46,13 +54,13 @@ end def url_encode(s) - ERB::Util.url_encode(s) + URI.encode(s.to_s, /\W/) end private def only_show_last_four_chars(token) - "#{'*'*(token.size - 4)}#{token[-4..-1]}" + "#{'*' * (token.size - 4)}#{token[-4..-1]}" end end end diff --git a/lib/gitlab/configuration.rb b/lib/gitlab/configuration.rb index a9a961c..50e723b 100644 --- a/lib/gitlab/configuration.rb +++ b/lib/gitlab/configuration.rb @@ -3,7 +3,7 @@ # Defines constants and methods related to configuration. module Configuration # An array of valid keys in the options hash when configuring a Gitlab::API. - VALID_OPTIONS_KEYS = [:endpoint, :private_token, :user_agent, :sudo, :httparty].freeze + VALID_OPTIONS_KEYS = %i(endpoint private_token user_agent sudo httparty).freeze # The user agent that will be sent to the API endpoint if none is set. DEFAULT_USER_AGENT = "Gitlab Ruby Gem #{Gitlab::VERSION}".freeze @@ -48,7 +48,7 @@ httparty = Gitlab::CLI::Helpers.yaml_load(options) - raise ArgumentError, "HTTParty config should be a Hash." unless httparty.is_a? Hash + raise ArgumentError, 'HTTParty config should be a Hash.' unless httparty.is_a? Hash Gitlab::CLI::Helpers.symbolize_keys httparty end end diff --git a/lib/gitlab/error.rb b/lib/gitlab/error.rb index ce10d0d..19f9383 100644 --- a/lib/gitlab/error.rb +++ b/lib/gitlab/error.rb @@ -11,16 +11,25 @@ # Custom error class for rescuing from HTTP response errors. class ResponseError < Error + POSSIBLE_MESSAGE_KEYS = %i(message error_description error) + def initialize(response) @response = response super(build_error_message) end - # Status code returned in the http response. + # Status code returned in the HTTP response. # # @return [Integer] def response_status @response.code + end + + # Body content returned in the HTTP response + # + # @return [String] + def response_message + @response.parsed_response.message end private @@ -30,11 +39,17 @@ # @return [String] def build_error_message parsed_response = @response.parsed_response - message = parsed_response.message || parsed_response.error - + message = check_error_keys(parsed_response) "Server responded with code #{@response.code}, message: " \ "#{handle_message(message)}. " \ "Request URI: #{@response.request.base_uri}#{@response.request.path}" + end + + # Error keys vary across the API, find the first key that the parsed_response + # object responds to and return that, otherwise return the original. + def check_error_keys(resp) + key = POSSIBLE_MESSAGE_KEYS.find { |k| resp.respond_to?(k) } + key ? resp.send(key) : resp end # Handle error response message in case of nested hashes diff --git a/lib/gitlab/file_response.rb b/lib/gitlab/file_response.rb index 7a8ed6a..bbda811 100644 --- a/lib/gitlab/file_response.rb +++ b/lib/gitlab/file_response.rb @@ -39,7 +39,7 @@ # Parse filename from the 'Content Disposition' header. def parse_headers!(headers) - @filename = headers[HEADER_CONTENT_DISPOSITION].split("filename=")[1] + @filename = headers[HEADER_CONTENT_DISPOSITION].split('filename=')[1] @filename = @filename[1...-1] if @filename[0] == '"' # Unquote filenames end end diff --git a/lib/gitlab/help.rb b/lib/gitlab/help.rb index 9037533..fd81bae 100644 --- a/lib/gitlab/help.rb +++ b/lib/gitlab/help.rb @@ -33,7 +33,7 @@ def ri_cmd which_ri = `which ri`.chomp if which_ri.empty? - fail "'ri' tool not found in $PATH. Please install it to use the help." + raise "'ri' tool not found in $PATH. Please install it to use the help." end which_ri @@ -61,7 +61,7 @@ def actions_table(topic=nil) rows = topic ? help_map[topic] : help_map.keys table do |t| - t.title = topic || "Help Topics" + t.title = topic || 'Help Topics' # add_row expects an array and we have strings hence the map. rows.sort.map { |r| [r] }.each_with_index do |row, index| @@ -73,7 +73,7 @@ # Returns full namespace of a command (e.g. Gitlab::Client::Branches.cmd) def namespace(cmd) - method_owners.select { |method| method[:name] === cmd }. + method_owners.select { |method| method[:name] == cmd }. map { |method| method[:owner] + '.' + method[:name] }. shift end @@ -82,14 +82,13 @@ def change_help_output!(cmd, output_str) output_str.gsub!(/#{cmd}\((.*?)\)/m, cmd + ' \1') output_str.gsub!(/\,[\s]*/, ' ') - + # Ensure @option descriptions are on a single line output_str.gsub!(/\n\[/, " \[") output_str.gsub!(/\s(@)/, "\n@") output_str.gsub!(/(\])\n(\:)/, '\1 \2') output_str.gsub!(/(\:.*)(\n)(.*\.)/, '\1 \3') output_str.gsub!(/\{(.+)\}/, '"{\1}"') - end - end # class << self + end end diff --git a/lib/gitlab/page_links.rb b/lib/gitlab/page_links.rb index 00aba19..4687ffe 100644 --- a/lib/gitlab/page_links.rb +++ b/lib/gitlab/page_links.rb @@ -6,7 +6,7 @@ HEADER_LINK = 'Link'.freeze DELIM_LINKS = ','.freeze LINK_REGEX = /<([^>]+)>; rel=\"([^\"]+)\"/ - METAS = %w(last next first prev) + METAS = %w(last next first prev).freeze attr_accessor(*METAS) @@ -25,7 +25,7 @@ LINK_REGEX.match(link.strip) do |match| url, meta = match[1], match[2] next if !url || !meta || METAS.index(meta).nil? - self.send("#{meta}=", url) + send("#{meta}=", url) end end end diff --git a/lib/gitlab/request.rb b/lib/gitlab/request.rb index d146e4b..8129cdc 100644 --- a/lib/gitlab/request.rb +++ b/lib/gitlab/request.rb @@ -26,58 +26,42 @@ elsif body.nil? false else - raise Error::Parsing.new "Couldn't parse a response body" + raise Error::Parsing, "Couldn't parse a response body" end end # Decodes a JSON response into Ruby object. def self.decode(response) - JSON.load response + return response ? JSON.load(response) : {} rescue JSON::ParserError - raise Error::Parsing.new "The response is not a valid JSON" + raise Error::Parsing, 'The response is not a valid JSON' end - def get(path, options={}) - set_httparty_config(options) - set_authorization_header(options) - validate self.class.get(@endpoint + path, options) - end - - def post(path, options={}) - set_httparty_config(options) - set_authorization_header(options) - validate self.class.post(@endpoint + path, options) - end - - def put(path, options={}) - set_httparty_config(options) - set_authorization_header(options) - validate self.class.put(@endpoint + path, options) - end - - def delete(path, options={}) - set_httparty_config(options) - set_authorization_header(options) - validate self.class.delete(@endpoint + path, options) + %w(get post put delete).each do |method| + define_method method do |path, options={}| + httparty_config(options) + authorization_header(options) + validate self.class.send(method, @endpoint + path, options) + end end # Checks the response code for common errors. # Returns parsed response for successful requests. def validate(response) error_klass = case response.code - when 400 then Error::BadRequest - when 401 then Error::Unauthorized - when 403 then Error::Forbidden - when 404 then Error::NotFound - when 405 then Error::MethodNotAllowed - when 409 then Error::Conflict - when 422 then Error::Unprocessable - when 500 then Error::InternalServerError - when 502 then Error::BadGateway - when 503 then Error::ServiceUnavailable - end + when 400 then Error::BadRequest + when 401 then Error::Unauthorized + when 403 then Error::Forbidden + when 404 then Error::NotFound + when 405 then Error::MethodNotAllowed + when 409 then Error::Conflict + when 422 then Error::Unprocessable + when 500 then Error::InternalServerError + when 502 then Error::BadGateway + when 503 then Error::ServiceUnavailable + end - fail error_klass.new(response) if error_klass + raise error_klass, response if error_klass parsed = response.parsed_response parsed.client = self if parsed.respond_to?(:client=) @@ -87,9 +71,9 @@ # Sets a base_uri and default_params for requests. # @raise [Error::MissingCredentials] if endpoint not set. - def set_request_defaults(sudo=nil) + def request_defaults(sudo=nil) self.class.default_params sudo: sudo - raise Error::MissingCredentials.new("Please set an endpoint to API") unless @endpoint + raise Error::MissingCredentials, 'Please set an endpoint to API' unless @endpoint self.class.default_params.delete(:sudo) if sudo.nil? end @@ -100,20 +84,20 @@ # @param [Hash] options A customizable set of options. # @option options [Boolean] :unauthenticated true if the API call does not require user authentication. # @raise [Error::MissingCredentials] if private_token and auth_token are not set. - def set_authorization_header(options) - unless options[:unauthenticated] - raise Error::MissingCredentials.new("Please provide a private_token or auth_token for user") unless @private_token - if @private_token.length <= 20 - options[:headers] = { 'PRIVATE-TOKEN' => @private_token } - else - options[:headers] = { 'Authorization' => "Bearer #{@private_token}" } - end - end + def authorization_header(options) + return if options[:unauthenticated] + raise Error::MissingCredentials, 'Please provide a private_token or auth_token for user' unless @private_token + + options[:headers] = if @private_token.size < 21 + { 'PRIVATE-TOKEN' => @private_token } + else + { 'Authorization' => "Bearer #{@private_token}" } + end end # Set HTTParty configuration # @see https://github.com/jnunemaker/httparty - def set_httparty_config(options) + def httparty_config(options) options.merge!(httparty) if httparty end end diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb index 0616b3f..620adf3 100644 --- a/lib/gitlab/shell.rb +++ b/lib/gitlab/shell.rb @@ -63,13 +63,10 @@ # Execute a given command with arguements def execute(cmd=command, args=arguments) - if actions.include?(cmd.to_sym) - confirm_command(cmd) - gitlab_helper(cmd, args) - else - fail "Unknown command: #{cmd}. " \ - "See the 'help' for a list of valid commands." - end + raise "Unknown command: #{cmd}. See the 'help' for a list of valid commands." unless actions.include?(cmd.to_sym) + + confirm_command(cmd) + gitlab_helper(cmd, args) end def quit_shell @@ -80,5 +77,5 @@ def history @history ||= History.new end - end # class << self + end end diff --git a/lib/gitlab/version.rb b/lib/gitlab/version.rb index 5cf9381..50e7d36 100644 --- a/lib/gitlab/version.rb +++ b/lib/gitlab/version.rb @@ -1,3 +1,3 @@ module Gitlab - VERSION = "4.2.0" + VERSION = '4.5.0'.freeze end diff --git a/lib/gitlab.rb b/lib/gitlab.rb index a3ac3eb..b7d5488 100644 --- a/lib/gitlab.rb +++ b/lib/gitlab.rb @@ -26,7 +26,7 @@ end # Delegate to Gitlab::Client - def respond_to_missing?(method_name, include_private = false) + def self.respond_to_missing?(method_name, include_private=false) client.respond_to?(method_name) || super end @@ -39,7 +39,7 @@ # # @return [Array] def self.actions - hidden = /endpoint|private_token|auth_token|user_agent|sudo|get|post|put|\Adelete\z|validate|set_request_defaults|httparty/ + hidden = /endpoint|private_token|auth_token|user_agent|sudo|get|post|put|\Adelete\z|validate|request_defaults|httparty/ (Gitlab::Client.instance_methods - Object.methods).reject { |e| e[hidden] } end end diff --git a/spec/fixtures/board_list.json b/spec/fixtures/board_list.json deleted file mode 100644 index 8387063..0000000 --- a/spec/fixtures/board_list.json +++ /dev/null @@ -1 +0,0 @@ -{ "id" : 1, "label" : { "name" : "Testing", "color" : "#F0AD4E", "description" : null }, "position" : 1 } diff --git a/spec/fixtures/board_lists.json b/spec/fixtures/board_lists.json deleted file mode 100644 index baf7d86..0000000 --- a/spec/fixtures/board_lists.json +++ /dev/null @@ -1 +0,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 } ] diff --git a/spec/fixtures/boards.json b/spec/fixtures/boards.json deleted file mode 100644 index beaac52..0000000 --- a/spec/fixtures/boards.json +++ /dev/null @@ -1 +0,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 } ] } ] diff --git a/spec/fixtures/branch.json b/spec/fixtures/branch.json deleted file mode 100644 index 34a0208..0000000 --- a/spec/fixtures/branch.json +++ /dev/null @@ -1 +0,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} diff --git a/spec/fixtures/branch_delete.json b/spec/fixtures/branch_delete.json deleted file mode 100644 index 4ec8edb..0000000 --- a/spec/fixtures/branch_delete.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "branch_name": "api" -} diff --git a/spec/fixtures/branches.json b/spec/fixtures/branches.json deleted file mode 100644 index 05a3944..0000000 --- a/spec/fixtures/branches.json +++ /dev/null @@ -1 +0,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"}}] diff --git a/spec/fixtures/build.json b/spec/fixtures/build.json deleted file mode 100644 index c0c9b2f..0000000 --- a/spec/fixtures/build.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "commit": { - "author_email": "admin@example.com", - "author_name": "Administrator", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2015-12-24T15:51:21.880Z", - "download_url": null, - "finished_at": "2015-12-24T17:54:31.198Z", - "id": 8, - "name": "rubocop", - "ref": "master", - "runner": null, - "stage": "test", - "started_at": "2015-12-24T17:54:30.733Z", - "status": "failed", - "tag": false, - "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", - "id": 1, - "is_admin": true, - "linkedin": "", - "name": "John Smith", - "skype": "", - "state": "active", - "twitter": "", - "username": "root", - "web_url": "http://gitlab.dev/u/root", - "website_url": "" - } -} \ No newline at end of file diff --git a/spec/fixtures/build_artifacts.json b/spec/fixtures/build_artifacts.json deleted file mode 100644 index 6851e34..0000000 Binary files a/spec/fixtures/build_artifacts.json and /dev/null differ diff --git a/spec/fixtures/build_cancel.json b/spec/fixtures/build_cancel.json deleted file mode 100644 index dd54823..0000000 --- a/spec/fixtures/build_cancel.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "commit": { - "author_email": "admin@example.com", - "author_name": "John Smith", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2016-01-11T10:13:33.506Z", - "download_url": null, - "finished_at": "2016-01-11T10:14:09.526Z", - "id": 69, - "name": "rubocop", - "ref": "master", - "runner": null, - "stage": "test", - "started_at": null, - "status": "canceled", - "tag": false, - "user": null -} \ No newline at end of file diff --git a/spec/fixtures/build_erase.json b/spec/fixtures/build_erase.json deleted file mode 100644 index d745979..0000000 --- a/spec/fixtures/build_erase.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "commit": { - "author_email": "admin@example.com", - "author_name": "John Smith", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "download_url": null, - "id": 69, - "name": "rubocop", - "ref": "master", - "runner": null, - "stage": "test", - "created_at": "2016-01-11T10:13:33.506Z", - "started_at": "2016-01-11T10:13:33.506Z", - "finished_at": "2016-01-11T10:15:10.506Z", - "status": "failed", - "tag": false, - "user": null -} diff --git a/spec/fixtures/build_retry.json b/spec/fixtures/build_retry.json deleted file mode 100644 index 04ddb26..0000000 --- a/spec/fixtures/build_retry.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "commit": { - "author_email": "admin@example.com", - "author_name": "John Smith", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2016-01-11T10:13:33.506Z", - "download_url": null, - "finished_at": null, - "id": 69, - "name": "rubocop", - "ref": "master", - "runner": null, - "stage": "test", - "started_at": null, - "status": "pending", - "tag": false, - "user": null -} \ No newline at end of file diff --git a/spec/fixtures/builds.json b/spec/fixtures/builds.json deleted file mode 100644 index 1b93d75..0000000 --- a/spec/fixtures/builds.json +++ /dev/null @@ -1,78 +0,0 @@ -[ - { - "commit": { - "author_email": "admin@example.com", - "author_name": "Administrator", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2015-12-24T15:51:21.802Z", - "download_url": null, - "finished_at": "2015-12-24T17:54:27.895Z", - "id": 7, - "name": "teaspoon", - "ref": "master", - "runner": null, - "stage": "test", - "started_at": "2015-12-24T17:54:27.722Z", - "status": "failed", - "tag": false, - "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", - "id": 1, - "is_admin": true, - "linkedin": "", - "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", - "username": "root", - "web_url": "http://gitlab.dev/u/root", - "website_url": "" - } - }, - { - "commit": { - "author_email": "admin@example.com", - "author_name": "Administrator", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2015-12-24T15:51:21.727Z", - "download_url": null, - "finished_at": "2015-12-24T17:54:24.921Z", - "id": 6, - "name": "spinach:other", - "ref": "master", - "runner": null, - "stage": "test", - "started_at": "2015-12-24T17:54:24.729Z", - "status": "failed", - "tag": false, - "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", - "id": 1, - "is_admin": true, - "linkedin": "", - "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", - "username": "root", - "web_url": "http://gitlab.dev/u/root", - "website_url": "" - } - } -] \ No newline at end of file diff --git a/spec/fixtures/builds_commits.json b/spec/fixtures/builds_commits.json deleted file mode 100644 index ba08b72..0000000 --- a/spec/fixtures/builds_commits.json +++ /dev/null @@ -1,64 +0,0 @@ -[ - { - "commit": { - "author_email": "admin@example.com", - "author_name": "Administrator", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2016-01-11T10:13:33.506Z", - "download_url": null, - "finished_at": "2016-01-11T10:14:09.526Z", - "id": 69, - "name": "rubocop", - "ref": "master", - "runner": null, - "stage": "test", - "started_at": null, - "status": "canceled", - "tag": false, - "user": null - }, - { - "commit": { - "author_email": "admin@example.com", - "author_name": "Administrator", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2015-12-24T15:51:21.957Z", - "download_url": null, - "finished_at": "2015-12-24T17:54:33.913Z", - "id": 9, - "name": "brakeman", - "ref": "master", - "runner": null, - "stage": "test", - "started_at": "2015-12-24T17:54:33.727Z", - "status": "failed", - "tag": false, - "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", - "id": 1, - "is_admin": true, - "linkedin": "", - "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", - "username": "root", - "web_url": "http://gitlab.dev/u/root", - "website_url": "" - } - } -] \ No newline at end of file diff --git a/spec/fixtures/compare_merge_request_diff.json b/spec/fixtures/compare_merge_request_diff.json deleted file mode 100644 index e4bc855..0000000 --- a/spec/fixtures/compare_merge_request_diff.json +++ /dev/null @@ -1,31 +0,0 @@ - -{ - "commit": { - "id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1", - "short_id": "12d65c8dd2b", - "title": "JS fix", - "author_name": "Dmitriy Zaporozhets", - "author_email": "dmitriy.zaporozhets@gmail.com", - "created_at": "2014-02-27T10:27:00+02:00" - }, - "commits": [{ - "id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1", - "short_id": "12d65c8dd2b", - "title": "JS fix", - "author_name": "Dmitriy Zaporozhets", - "author_email": "dmitriy.zaporozhets@gmail.com", - "created_at": "2014-02-27T10:27:00+02:00" - }], - "diffs": [{ - "old_path": "files/js/application.js", - "new_path": "files/js/application.js", - "a_mode": null, - "b_mode": "100644", - "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+}", - "new_file": false, - "renamed_file": false, - "deleted_file": false - }], - "compare_timeout": false, - "compare_same_ref": false -} diff --git a/spec/fixtures/empty.json b/spec/fixtures/empty.json deleted file mode 100644 index e69de29..0000000 diff --git a/spec/fixtures/environment.json b/spec/fixtures/environment.json deleted file mode 100644 index d1c004b..0000000 --- a/spec/fixtures/environment.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "id": 12, - "name": "staging", - "slug": "staging-cb247rv", - "external_url": "https://staging.example.gitlab.com" -} \ No newline at end of file diff --git a/spec/fixtures/environments.json b/spec/fixtures/environments.json deleted file mode 100644 index e1feeb5..0000000 --- a/spec/fixtures/environments.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "id": 1, - "name": "review/fix-foo", - "slug": "review-fix-foo-dfjre3", - "external_url": "https://review-fix-foo-dfjre3.example.gitlab.com" - }, - { - "id": 12, - "name": "review/fix-bar", - "slug": "review-fix-bar-dbwr18", - "external_url": "https://review-fix-bar-dbwr18.example.gitlab.com" - } -] \ No newline at end of file diff --git a/spec/fixtures/error_already_exists.json b/spec/fixtures/error_already_exists.json deleted file mode 100644 index d1070f5..0000000 --- a/spec/fixtures/error_already_exists.json +++ /dev/null @@ -1 +0,0 @@ -{"message": "409 Already exists"} \ No newline at end of file diff --git a/spec/fixtures/error_project_not_found.json b/spec/fixtures/error_project_not_found.json deleted file mode 100644 index f0d4e3a..0000000 --- a/spec/fixtures/error_project_not_found.json +++ /dev/null @@ -1 +0,0 @@ -{"message": "404 Project Not Found"} diff --git a/spec/fixtures/get_repository_file.json b/spec/fixtures/get_repository_file.json deleted file mode 100644 index a5120eb..0000000 --- a/spec/fixtures/get_repository_file.json +++ /dev/null @@ -1 +0,0 @@ -{"file_name":"README.md", "file_path":"README.md", "size":"19", "encoding":"base64", "content":"VGhpcyBpcyBhICpSRUFETUUqIQ==\n", "ref":"master", "blob_id":"0eba9dff767611060181e0423a1de2941d27efc8", "commit_id":"eb38397cb6ae669219e6bc18ad19981fff18ea29"} diff --git a/spec/fixtures/group.json b/spec/fixtures/group.json deleted file mode 100644 index bce3581..0000000 --- a/spec/fixtures/group.json +++ /dev/null @@ -1,60 +0,0 @@ -{"id": 10, "name": "GitLab-Group", "path": "gitlab-group", "owner_id": 6, "projects": [ - { - "id": 9, - "name": "mojito", - "description": null, - "default_branch": "master", - "owner": { - "id": 6, - "username": "jose", - "email": "jose@abc.com", - "name": "Jose Jose", - "blocked": false, - "created_at": "2013-02-06T06:54:06Z" - }, - "path": "mojito", - "path_with_namespace": "gitlab-group/mojito", - "issues_enabled": true, - "merge_requests_enabled": true, - "wall_enabled": true, - "wiki_enabled": true, - "created_at": "2013-02-06T16:59:15Z", - "namespace": { - "created_at": "2013-02-06T16:58:22Z", - "id": 10, - "name": "GitLab-Group", - "owner_id": 6, - "path": "gitlab-group", - "updated_at": "2013-02-06T16:58:22Z" - } - }, - { - "id": 10, - "name": "gitlabhq", - "description": null, - "default_branch": null, - "owner": { - "id": 6, - "username": "randx", - "email": "randx@github.com", - "name": "Dmitry Z", - "blocked": false, - "created_at": "2013-02-06T06:54:06Z" - }, - "path": "gitlabhq", - "path_with_namespace": "gitlab-group/gitlabhq", - "issues_enabled": true, - "merge_requests_enabled": true, - "wall_enabled": true, - "wiki_enabled": true, - "created_at": "2013-02-06T17:02:31Z", - "namespace": { - "created_at": "2013-02-06T16:58:22Z", - "id": 10, - "name": "GitLab-Group", - "owner_id": 6, - "path": "gitlab-group", - "updated_at": "2013-02-06T16:58:22Z" - } - } -]} \ No newline at end of file diff --git a/spec/fixtures/group_create.json b/spec/fixtures/group_create.json deleted file mode 100644 index 67445f6..0000000 --- a/spec/fixtures/group_create.json +++ /dev/null @@ -1 +0,0 @@ -{"id":3,"name":"Gitlab-Group","path":"gitlab-group","owner_id":1} \ No newline at end of file diff --git a/spec/fixtures/group_create_with_description.json b/spec/fixtures/group_create_with_description.json deleted file mode 100644 index 326e726..0000000 --- a/spec/fixtures/group_create_with_description.json +++ /dev/null @@ -1 +0,0 @@ -{"id":3,"name":"Gitlab-Group","path":"gitlab-group","owner_id":1,"description":"gitlab group description"} \ No newline at end of file diff --git a/spec/fixtures/group_delete.json b/spec/fixtures/group_delete.json deleted file mode 100644 index a304bce..0000000 --- a/spec/fixtures/group_delete.json +++ /dev/null @@ -1 +0,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"} diff --git a/spec/fixtures/group_member.json b/spec/fixtures/group_member.json deleted file mode 100644 index feef543..0000000 --- a/spec/fixtures/group_member.json +++ /dev/null @@ -1 +0,0 @@ -{"id":2,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-09-04T18:15:30Z","access_level":10} \ No newline at end of file diff --git a/spec/fixtures/group_member_delete.json b/spec/fixtures/group_member_delete.json deleted file mode 100644 index ff052ed..0000000 --- a/spec/fixtures/group_member_delete.json +++ /dev/null @@ -1 +0,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} \ No newline at end of file diff --git a/spec/fixtures/group_member_edit.json b/spec/fixtures/group_member_edit.json deleted file mode 100644 index 324f730..0000000 --- a/spec/fixtures/group_member_edit.json +++ /dev/null @@ -1 +0,0 @@ -{"id":2,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-09-04T18:15:30Z","access_level":50} \ No newline at end of file diff --git a/spec/fixtures/group_members.json b/spec/fixtures/group_members.json deleted file mode 100644 index 02ddc10..0000000 --- a/spec/fixtures/group_members.json +++ /dev/null @@ -1 +0,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}] \ No newline at end of file diff --git a/spec/fixtures/group_projects.json b/spec/fixtures/group_projects.json deleted file mode 100644 index 23211e2..0000000 --- a/spec/fixtures/group_projects.json +++ /dev/null @@ -1,44 +0,0 @@ -[ - { - "id": 4, - "description": null, - "default_branch": "master", - "public": false, - "visibility_level": 0, - "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", - "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git", - "web_url": "http://example.com/diaspora/diaspora-client", - "tag_list": [ - "example", - "disapora client" - ], - "owner": { - "id": 3, - "name": "Diaspora", - "created_at": "2013-09-30T13: 46: 02Z" - }, - "name": "Diaspora Client", - "name_with_namespace": "Diaspora / Diaspora Client", - "path": "diaspora-client", - "path_with_namespace": "diaspora/diaspora-client", - "issues_enabled": true, - "merge_requests_enabled": true, - "builds_enabled": true, - "wiki_enabled": true, - "snippets_enabled": false, - "created_at": "2013-09-30T13: 46: 02Z", - "last_activity_at": "2013-09-30T13: 46: 02Z", - "creator_id": 3, - "namespace": { - "created_at": "2013-09-30T13: 46: 02Z", - "description": "", - "id": 3, - "name": "Diaspora", - "owner_id": 1, - "path": "diaspora", - "updated_at": "2013-09-30T13: 46: 02Z" - }, - "archived": false, - "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png" - } -] diff --git a/spec/fixtures/group_search.json b/spec/fixtures/group_search.json deleted file mode 100644 index e6b4daa..0000000 --- a/spec/fixtures/group_search.json +++ /dev/null @@ -1,2 +0,0 @@ -[{"id": 5,"name": "Five-Group","path": "five-group","owner_id": 2},{"id": 8,"name": "Eight Group","path": "eight-group","owner_id": 6} -] diff --git a/spec/fixtures/groups.json b/spec/fixtures/groups.json deleted file mode 100644 index 7d8b426..0000000 --- a/spec/fixtures/groups.json +++ /dev/null @@ -1,2 +0,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} -] \ No newline at end of file diff --git a/spec/fixtures/issue.json b/spec/fixtures/issue.json deleted file mode 100644 index 9f70318..0000000 --- a/spec/fixtures/issue.json +++ /dev/null @@ -1 +0,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"} \ No newline at end of file diff --git a/spec/fixtures/issue_award_emoji.json b/spec/fixtures/issue_award_emoji.json deleted file mode 100644 index fefeaf1..0000000 --- a/spec/fixtures/issue_award_emoji.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "id": 4, - "name": "blowfish", - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://gitlab.example.com/root" - }, - "created_at": "2016-06-15T10:09:34.206Z", - "updated_at": "2016-06-15T10:09:34.206Z", - "awardable_id": 80, - "awardable_type": "Issue" -} \ No newline at end of file diff --git a/spec/fixtures/issue_award_emojis.json b/spec/fixtures/issue_award_emojis.json deleted file mode 100644 index 44338b8..0000000 --- a/spec/fixtures/issue_award_emojis.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "id": 4, - "name": "1234", - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://gitlab.example.com/root" - }, - "created_at": "2016-06-15T10:09:34.206Z", - "updated_at": "2016-06-15T10:09:34.206Z", - "awardable_id": 80, - "awardable_type": "Issue" - }, - { - "id": 1, - "name": "microphone", - "user": { - "name": "User 4", - "username": "user4", - "id": 26, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", - "web_url": "http://gitlab.example.com/user4" - }, - "created_at": "2016-06-15T10:09:34.177Z", - "updated_at": "2016-06-15T10:09:34.177Z", - "awardable_id": 80, - "awardable_type": "Issue" - } -] \ No newline at end of file diff --git a/spec/fixtures/issues.json b/spec/fixtures/issues.json deleted file mode 100644 index 62e4cad..0000000 --- a/spec/fixtures/issues.json +++ /dev/null @@ -1 +0,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"}] \ No newline at end of file diff --git a/spec/fixtures/job.json b/spec/fixtures/job.json deleted file mode 100644 index 0207e1f..0000000 --- a/spec/fixtures/job.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "commit": { - "author_email": "admin@example.com", - "author_name": "Administrator", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2015-12-24T15:51:21.880Z", - "artifacts_file": null, - "finished_at": "2015-12-24T17:54:31.198Z", - "id": 8, - "name": "rubocop", - "pipeline": { - "id": 6, - "ref": "master", - "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "status": "pending" - }, - "ref": "master", - "runner": null, - "stage": "test", - "started_at": "2015-12-24T17:54:30.733Z", - "status": "failed", - "tag": false, - "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", - "id": 1, - "linkedin": "", - "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", - "username": "root", - "web_url": "http://gitlab.dev/root", - "website_url": "" - } -} diff --git a/spec/fixtures/job_trace.json b/spec/fixtures/job_trace.json deleted file mode 100644 index bf7e899..0000000 --- a/spec/fixtures/job_trace.json +++ /dev/null @@ -1 +0,0 @@ -asdasd diff --git a/spec/fixtures/jobs.json b/spec/fixtures/jobs.json deleted file mode 100644 index 5ea084b..0000000 --- a/spec/fixtures/jobs.json +++ /dev/null @@ -1,91 +0,0 @@ -[ - { - "commit": { - "author_email": "admin@example.com", - "author_name": "Administrator", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2015-12-24T15:51:21.802Z", - "artifacts_file": { - "filename": "artifacts.zip", - "size": 1000 - }, - "finished_at": "2015-12-24T17:54:27.895Z", - "id": 7, - "name": "teaspoon", - "pipeline": { - "id": 6, - "ref": "master", - "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "status": "pending" - }, - "ref": "master", - "runner": null, - "stage": "test", - "started_at": "2015-12-24T17:54:27.722Z", - "status": "failed", - "tag": false, - "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", - "id": 1, - "linkedin": "", - "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", - "username": "root", - "web_url": "http://gitlab.dev/root", - "website_url": "" - } - }, - { - "commit": { - "author_email": "admin@example.com", - "author_name": "Administrator", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2015-12-24T15:51:21.727Z", - "artifacts_file": null, - "finished_at": "2015-12-24T17:54:24.921Z", - "id": 6, - "name": "spinach:other", - "pipeline": { - "id": 6, - "ref": "master", - "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "status": "pending" - }, - "ref": "master", - "runner": null, - "stage": "test", - "started_at": "2015-12-24T17:54:24.729Z", - "status": "failed", - "tag": false, - "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", - "id": 1, - "linkedin": "", - "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", - "username": "root", - "web_url": "http://gitlab.dev/root", - "website_url": "" - } - } -] diff --git a/spec/fixtures/key.json b/spec/fixtures/key.json deleted file mode 100644 index 6595c8c..0000000 --- a/spec/fixtures/key.json +++ /dev/null @@ -1 +0,0 @@ -{"id":1,"title":"narkoz@helium","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkUsh42Nh1yefGd1jbSELn5XsY8p5Oxmau0/1HqHnjuYOaj5X+kHccFDwtmtg9Ox8ua/+WptNsiE8IUwsD3zKgEjajgwq3gMeeFdxfXwM+tEvHOOMV9meRrgRWGYCToPbT6sR7/YMAYa7cPqWSpx/oZhYfz4XtoMv3ZZT1fZMmx3MY3HwXwW8j+obJyN2K4LN0TFi9RPgWWYn0DCyb9OccmABimt3i74WoJ/OT8r6/7swce8+OSe0Q2wBhyTtvxg2vtUcoek8Af+EZaUMBwSEzEsocOCzwQvjF5XUk5o7dJ8nP8W3RE60JWX57t16eQm7lBmumLYfszpn2isd6W7a1 narkoz@helium"} diff --git a/spec/fixtures/keys.json b/spec/fixtures/keys.json deleted file mode 100644 index d81fca6..0000000 --- a/spec/fixtures/keys.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":1,"title":"narkoz@helium","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkUsh42Nh1yefGd1jbSELn5XsY8p5Oxmau0/1HqHnjuYOaj5X+kHccFDwtmtg9Ox8ua/+WptNsiE8IUwsD3zKgEjajgwq3gMeeFdxfXwM+tEvHOOMV9meRrgRWGYCToPbT6sR7/YMAYa7cPqWSpx/oZhYfz4XtoMv3ZZT1fZMmx3MY3HwXwW8j+obJyN2K4LN0TFi9RPgWWYn0DCyb9OccmABimt3i74WoJ/OT8r6/7swce8+OSe0Q2wBhyTtvxg2vtUcoek8Af+EZaUMBwSEzEsocOCzwQvjF5XUk5o7dJ8nP8W3RE60JWX57t16eQm7lBmumLYfszpn2isd6W7a1 narkoz@helium"}] diff --git a/spec/fixtures/label.json b/spec/fixtures/label.json deleted file mode 100644 index 8e8ef22..0000000 --- a/spec/fixtures/label.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "Backlog", "color": "#DD10AA", "subscribed": true} diff --git a/spec/fixtures/label_unsubscribe.json b/spec/fixtures/label_unsubscribe.json deleted file mode 100644 index aebc94d..0000000 --- a/spec/fixtures/label_unsubscribe.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "Backlog", "color": "#DD10AA", "subscribed": false} diff --git a/spec/fixtures/labels.json b/spec/fixtures/labels.json deleted file mode 100644 index fb995e3..0000000 --- a/spec/fixtures/labels.json +++ /dev/null @@ -1 +0,0 @@ -[{"name": "Backlog", "color": "#DD10AA"},{"name": "Documentation", "color": "#1E80DD"}] diff --git a/spec/fixtures/merge_request.json b/spec/fixtures/merge_request.json deleted file mode 100644 index 5278f46..0000000 --- a/spec/fixtures/merge_request.json +++ /dev/null @@ -1 +0,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"}} \ No newline at end of file diff --git a/spec/fixtures/merge_request_award_emoji.json b/spec/fixtures/merge_request_award_emoji.json deleted file mode 100644 index 491493a..0000000 --- a/spec/fixtures/merge_request_award_emoji.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "id": 4, - "name": "blowfish", - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://gitlab.example.com/root" - }, - "created_at": "2016-06-15T10:09:34.206Z", - "updated_at": "2016-06-15T10:09:34.206Z", - "awardable_id": 80, - "awardable_type": "MergeRequest" -} \ No newline at end of file diff --git a/spec/fixtures/merge_request_award_emojis.json b/spec/fixtures/merge_request_award_emojis.json deleted file mode 100644 index 1cb0758..0000000 --- a/spec/fixtures/merge_request_award_emojis.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "id": 4, - "name": "1234", - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://gitlab.example.com/root" - }, - "created_at": "2016-06-15T10:09:34.206Z", - "updated_at": "2016-06-15T10:09:34.206Z", - "awardable_id": 80, - "awardable_type": "MergeRequest" - }, - { - "id": 1, - "name": "microphone", - "user": { - "name": "User 4", - "username": "user4", - "id": 26, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", - "web_url": "http://gitlab.example.com/user4" - }, - "created_at": "2016-06-15T10:09:34.177Z", - "updated_at": "2016-06-15T10:09:34.177Z", - "awardable_id": 80, - "awardable_type": "MergeRequest" - } -] \ No newline at end of file diff --git a/spec/fixtures/merge_request_changes.json b/spec/fixtures/merge_request_changes.json deleted file mode 100644 index 6a75abf..0000000 --- a/spec/fixtures/merge_request_changes.json +++ /dev/null @@ -1 +0,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}]} \ No newline at end of file diff --git a/spec/fixtures/merge_request_closes_issues.json b/spec/fixtures/merge_request_closes_issues.json deleted file mode 100644 index 4a12eff..0000000 --- a/spec/fixtures/merge_request_closes_issues.json +++ /dev/null @@ -1 +0,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"}] diff --git a/spec/fixtures/merge_request_comment.json b/spec/fixtures/merge_request_comment.json deleted file mode 100644 index 742f333..0000000 --- a/spec/fixtures/merge_request_comment.json +++ /dev/null @@ -1 +0,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"}} \ No newline at end of file diff --git a/spec/fixtures/merge_request_comments.json b/spec/fixtures/merge_request_comments.json deleted file mode 100644 index 3b9733e..0000000 --- a/spec/fixtures/merge_request_comments.json +++ /dev/null @@ -1 +0,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"}}] diff --git a/spec/fixtures/merge_request_commits.json b/spec/fixtures/merge_request_commits.json deleted file mode 100644 index 806277d..0000000 --- a/spec/fixtures/merge_request_commits.json +++ /dev/null @@ -1 +0,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"}] diff --git a/spec/fixtures/merge_requests.json b/spec/fixtures/merge_requests.json deleted file mode 100644 index ea32ac4..0000000 --- a/spec/fixtures/merge_requests.json +++ /dev/null @@ -1 +0,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"}}] diff --git a/spec/fixtures/milestone.json b/spec/fixtures/milestone.json deleted file mode 100644 index 94ea3d3..0000000 --- a/spec/fixtures/milestone.json +++ /dev/null @@ -1 +0,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"} \ No newline at end of file diff --git a/spec/fixtures/milestone_issues.json b/spec/fixtures/milestone_issues.json deleted file mode 100644 index 32597d0..0000000 --- a/spec/fixtures/milestone_issues.json +++ /dev/null @@ -1 +0,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"}] \ No newline at end of file diff --git a/spec/fixtures/milestone_merge_requests.json b/spec/fixtures/milestone_merge_requests.json deleted file mode 100644 index aa01a29..0000000 --- a/spec/fixtures/milestone_merge_requests.json +++ /dev/null @@ -1 +0,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"}] diff --git a/spec/fixtures/milestones.json b/spec/fixtures/milestones.json deleted file mode 100644 index f9e309a..0000000 --- a/spec/fixtures/milestones.json +++ /dev/null @@ -1 +0,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"}] \ No newline at end of file diff --git a/spec/fixtures/namespaces.json b/spec/fixtures/namespaces.json deleted file mode 100644 index ae2538b..0000000 --- a/spec/fixtures/namespaces.json +++ /dev/null @@ -1 +0,0 @@ -[{"id": 1, "path": "john", "kind": "user"}] diff --git a/spec/fixtures/note.json b/spec/fixtures/note.json deleted file mode 100644 index 3f575ae..0000000 --- a/spec/fixtures/note.json +++ /dev/null @@ -1 +0,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"} diff --git a/spec/fixtures/note_award_emoji.json b/spec/fixtures/note_award_emoji.json deleted file mode 100644 index 26c7413..0000000 --- a/spec/fixtures/note_award_emoji.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "id": 4, - "name": "mood_bubble_lightning", - "user": { - "name": "User 4", - "username": "user4", - "id": 26, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", - "web_url": "http://gitlab.example.com/user4" - }, - "created_at": "2016-06-15T10:09:34.197Z", - "updated_at": "2016-06-15T10:09:34.197Z", - "awardable_id": 1, - "awardable_type": "Note" -} diff --git a/spec/fixtures/note_award_emojis.json b/spec/fixtures/note_award_emojis.json deleted file mode 100644 index cc701ba..0000000 --- a/spec/fixtures/note_award_emojis.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "id": 2, - "name": "mood_bubble_lightning", - "user": { - "name": "User 4", - "username": "user4", - "id": 26, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", - "web_url": "http://gitlab.example.com/user4" - }, - "created_at": "2016-06-15T10:09:34.197Z", - "updated_at": "2016-06-15T10:09:34.197Z", - "awardable_id": 1, - "awardable_type": "Note" - } -] \ No newline at end of file diff --git a/spec/fixtures/notes.json b/spec/fixtures/notes.json deleted file mode 100644 index 15c0d8c..0000000 --- a/spec/fixtures/notes.json +++ /dev/null @@ -1 +0,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"}] diff --git a/spec/fixtures/pipeline.json b/spec/fixtures/pipeline.json deleted file mode 100644 index d015a6a..0000000 --- a/spec/fixtures/pipeline.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "id": 46, - "status": "success", - "ref": "master", - "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", - "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", - "tag": false, - "yaml_errors": null, - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://localhost:3000/root" - }, - "created_at": "2016-08-11T11:28:34.085Z", - "updated_at": "2016-08-11T11:32:35.169Z", - "started_at": null, - "finished_at": "2016-08-11T11:32:35.145Z", - "committed_at": null, - "duration": null -} \ No newline at end of file diff --git a/spec/fixtures/pipeline_cancel.json b/spec/fixtures/pipeline_cancel.json deleted file mode 100644 index fd3fcba..0000000 --- a/spec/fixtures/pipeline_cancel.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "id": 46, - "status": "canceled", - "ref": "master", - "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", - "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", - "tag": false, - "yaml_errors": null, - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://localhost:3000/root" - }, - "created_at": "2016-08-11T11:28:34.085Z", - "updated_at": "2016-08-11T11:32:35.169Z", - "started_at": null, - "finished_at": "2016-08-11T11:32:35.145Z", - "committed_at": null, - "duration": null -} \ No newline at end of file diff --git a/spec/fixtures/pipeline_create.json b/spec/fixtures/pipeline_create.json deleted file mode 100644 index b687baa..0000000 --- a/spec/fixtures/pipeline_create.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "id": 61, - "sha": "384c444e840a515b23f21915ee5766b87068a70d", - "ref": "master", - "status": "pending", - "before_sha": "0000000000000000000000000000000000000000", - "tag": false, - "yaml_errors": null, - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://localhost:3000/root" - }, - "created_at": "2016-11-04T09:36:13.747Z", - "updated_at": "2016-11-04T09:36:13.977Z", - "started_at": null, - "finished_at": null, - "committed_at": null, - "duration": null -} \ No newline at end of file diff --git a/spec/fixtures/pipeline_jobs.json b/spec/fixtures/pipeline_jobs.json deleted file mode 100644 index 5ea084b..0000000 --- a/spec/fixtures/pipeline_jobs.json +++ /dev/null @@ -1,91 +0,0 @@ -[ - { - "commit": { - "author_email": "admin@example.com", - "author_name": "Administrator", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2015-12-24T15:51:21.802Z", - "artifacts_file": { - "filename": "artifacts.zip", - "size": 1000 - }, - "finished_at": "2015-12-24T17:54:27.895Z", - "id": 7, - "name": "teaspoon", - "pipeline": { - "id": 6, - "ref": "master", - "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "status": "pending" - }, - "ref": "master", - "runner": null, - "stage": "test", - "started_at": "2015-12-24T17:54:27.722Z", - "status": "failed", - "tag": false, - "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", - "id": 1, - "linkedin": "", - "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", - "username": "root", - "web_url": "http://gitlab.dev/root", - "website_url": "" - } - }, - { - "commit": { - "author_email": "admin@example.com", - "author_name": "Administrator", - "created_at": "2015-12-24T16:51:14.000+01:00", - "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "message": "Test the CI integration.", - "short_id": "0ff3ae19", - "title": "Test the CI integration." - }, - "coverage": null, - "created_at": "2015-12-24T15:51:21.727Z", - "artifacts_file": null, - "finished_at": "2015-12-24T17:54:24.921Z", - "id": 6, - "name": "spinach:other", - "pipeline": { - "id": 6, - "ref": "master", - "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", - "status": "pending" - }, - "ref": "master", - "runner": null, - "stage": "test", - "started_at": "2015-12-24T17:54:24.729Z", - "status": "failed", - "tag": false, - "user": { - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "bio": null, - "created_at": "2015-12-21T13:14:24.077Z", - "id": 1, - "linkedin": "", - "name": "Administrator", - "skype": "", - "state": "active", - "twitter": "", - "username": "root", - "web_url": "http://gitlab.dev/root", - "website_url": "" - } - } -] diff --git a/spec/fixtures/pipeline_retry.json b/spec/fixtures/pipeline_retry.json deleted file mode 100644 index 6fcd1ae..0000000 --- a/spec/fixtures/pipeline_retry.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "id": 46, - "status": "pending", - "ref": "master", - "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", - "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", - "tag": false, - "yaml_errors": null, - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://localhost:3000/root" - }, - "created_at": "2016-08-11T11:28:34.085Z", - "updated_at": "2016-08-11T11:32:35.169Z", - "started_at": null, - "finished_at": "2016-08-11T11:32:35.145Z", - "committed_at": null, - "duration": null -} \ No newline at end of file diff --git a/spec/fixtures/pipelines.json b/spec/fixtures/pipelines.json deleted file mode 100644 index c5bd396..0000000 --- a/spec/fixtures/pipelines.json +++ /dev/null @@ -1,48 +0,0 @@ -[ - { - "id": 47, - "status": "pending", - "ref": "new-pipeline", - "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", - "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", - "tag": false, - "yaml_errors": null, - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://localhost:3000/root" - }, - "created_at": "2016-08-16T10:23:19.007Z", - "updated_at": "2016-08-16T10:23:19.216Z", - "started_at": null, - "finished_at": null, - "committed_at": null, - "duration": null - }, - { - "id": 48, - "status": "pending", - "ref": "new-pipeline", - "sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a", - "before_sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a", - "tag": false, - "yaml_errors": null, - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://localhost:3000/root" - }, - "created_at": "2016-08-16T10:23:21.184Z", - "updated_at": "2016-08-16T10:23:21.314Z", - "started_at": null, - "finished_at": null, - "committed_at": null, - "duration": null - } -] \ No newline at end of file diff --git a/spec/fixtures/project.json b/spec/fixtures/project.json deleted file mode 100644 index 1f4f960..0000000 --- a/spec/fixtures/project.json +++ /dev/null @@ -1 +0,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"} \ No newline at end of file diff --git a/spec/fixtures/project_commit.json b/spec/fixtures/project_commit.json deleted file mode 100644 index ace52b7..0000000 --- a/spec/fixtures/project_commit.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6", - "short_id": "6104942438c", - "title": "Sanitize for network graph", - "author_name": "randx", - "author_email": "dmitriy.zaporozhets@gmail.com", - "created_at": "2012-09-20T09:06:12+03:00", - "committed_date": "2012-09-20T09:06:12+03:00", - "authored_date": "2012-09-20T09:06:12+03:00", - "parent_ids": [ - "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" - ] -} diff --git a/spec/fixtures/project_commit_comment.json b/spec/fixtures/project_commit_comment.json deleted file mode 100644 index d1cdd90..0000000 --- a/spec/fixtures/project_commit_comment.json +++ /dev/null @@ -1 +0,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"}} diff --git a/spec/fixtures/project_commit_comments.json b/spec/fixtures/project_commit_comments.json deleted file mode 100644 index 6690e29..0000000 --- a/spec/fixtures/project_commit_comments.json +++ /dev/null @@ -1 +0,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"}}] diff --git a/spec/fixtures/project_commit_create.json b/spec/fixtures/project_commit_create.json deleted file mode 100644 index a0fae22..0000000 --- a/spec/fixtures/project_commit_create.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "id": "ed899a2f4b50b4370feeea94676502b42383c746", - "short_id": "ed899a2f4b5", - "title": "some commit message", - "author_name": "Dmitriy Zaporozhets", - "author_email": "dzaporozhets@sphereconsultinginc.com", - "committer_name": "Dmitriy Zaporozhets", - "committer_email": "dzaporozhets@sphereconsultinginc.com", - "created_at": "2016-09-20T09:26:24.000-07:00", - "message": "some commit message", - "parent_ids": [ - "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" - ], - "committed_date": "2016-09-20T09:26:24.000-07:00", - "authored_date": "2016-09-20T09:26:24.000-07:00", - "stats": { - "additions": 2, - "deletions": 2, - "total": 4 - }, - "status": null -} \ No newline at end of file diff --git a/spec/fixtures/project_commit_diff.json b/spec/fixtures/project_commit_diff.json deleted file mode 100644 index ad3dfde..0000000 --- a/spec/fixtures/project_commit_diff.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "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", - "new_path": "doc/update/5.4-to-6.0.md", - "old_path": "doc/update/5.4-to-6.0.md", - "a_mode": null, - "b_mode": "100644", - "new_file": false, - "renamed_file": false, - "deleted_file": false -} diff --git a/spec/fixtures/project_commit_status.json b/spec/fixtures/project_commit_status.json deleted file mode 100644 index 4b852f8..0000000 --- a/spec/fixtures/project_commit_status.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "id": 496, - "sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8", - "ref": "decreased-spec", - "status": "failed", - "name": "test", - "target_url": null, - "description": null, - "created_at": "2015-10-23T23:35:48.693+02:00", - "started_at": null, - "finished_at": "2015-10-23T23:35:48.716+02:00", - "author": { - "name": "Dominik Sander", - "username": "dsander", - "id": 1, - "state": "active", - "avatar_url": "https://secure.gravatar.com/avatar/xxxxx?s=40&d=identicon", - "web_url": "https://github.com/u/dsander" - } - }, - { - "id": 493, - "sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8", - "ref": "decreased-spec", - "status": "success", - "name": "specs", - "target_url": "https://github.com/dsander/omniauth/builds/493", - "description": null, - "created_at": "2015-10-23T21:39:19.384+02:00", - "started_at": "2015-10-23T21:39:21.900+02:00", - "finished_at": "2015-10-23T21:39:35.215+02:00", - "author": { - "name": "Dominik Sander", - "username": "dsander", - "id": 1, - "state": "active", - "avatar_url": "https://secure.gravatar.com/avatar/xxxxx?s=40&d=identicon", - "web_url": "https://github.com/u/dsander" - } - } -] \ No newline at end of file diff --git a/spec/fixtures/project_commits.json b/spec/fixtures/project_commits.json deleted file mode 100644 index 58cb502..0000000 --- a/spec/fixtures/project_commits.json +++ /dev/null @@ -1 +0,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"}] \ No newline at end of file diff --git a/spec/fixtures/project_edit.json b/spec/fixtures/project_edit.json deleted file mode 100644 index b5b8d28..0000000 --- a/spec/fixtures/project_edit.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "id":3, - "code":"gitlab", - "name":"Gitlab-edit", - "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" -} diff --git a/spec/fixtures/project_events.json b/spec/fixtures/project_events.json deleted file mode 100644 index 4d5afc0..0000000 --- a/spec/fixtures/project_events.json +++ /dev/null @@ -1 +0,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"}] diff --git a/spec/fixtures/project_for_user.json b/spec/fixtures/project_for_user.json deleted file mode 100644 index e2835d8..0000000 --- a/spec/fixtures/project_for_user.json +++ /dev/null @@ -1 +0,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"} diff --git a/spec/fixtures/project_fork.json b/spec/fixtures/project_fork.json deleted file mode 100644 index f87d687..0000000 --- a/spec/fixtures/project_fork.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "id":20, - "description":"desc", - "default_branch":"master", - "tag_list":[ - - ], - "public":false, - "archived":false, - "visibility_level":10, - "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", - "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", - "web_url":"http://git.gitlab.com/root/gitlab", - "owner":{ - "name":"Administrator", - "username":"root", - "id":1, - "state":"active", - "avatar_url":"http://git.gitlab.com/uploads/user/avatar/1/12586377.jpeg" - }, - "name":"gitlab", - "name_with_namespace":"Administrator / gitlab", - "path":"gitlab", - "path_with_namespace":"root/gitlab", - "issues_enabled":true, - "merge_requests_enabled":true, - "wiki_enabled":true, - "snippets_enabled":false, - "created_at":"2015-06-08T01:29:17.190Z", - "last_activity_at":"2015-06-08T01:29:17.190Z", - "creator_id":1, - "namespace":{ - "id":1, - "name":"root", - "path":"root", - "owner_id":1, - "created_at":"2015-05-28T19:23:40.445Z", - "updated_at":"2015-05-28T19:23:40.445Z", - "description":"", - "avatar":null - }, - "forked_from_project":{ - "id":3, - "name":"Gitlab", - "name_with_namespace":"Root / gitlab", - "path":"gitlab", - "path_with_namespace":"root/gitlab" - }, - "avatar_url":null -} diff --git a/spec/fixtures/project_fork_link.json b/spec/fixtures/project_fork_link.json deleted file mode 100644 index f1490df..0000000 --- a/spec/fixtures/project_fork_link.json +++ /dev/null @@ -1 +0,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"} \ No newline at end of file diff --git a/spec/fixtures/project_forked_for_user.json b/spec/fixtures/project_forked_for_user.json deleted file mode 100644 index 254c517..0000000 --- a/spec/fixtures/project_forked_for_user.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "id":20, - "description":"desc", - "default_branch":"master", - "tag_list":[ - - ], - "public":false, - "archived":false, - "visibility_level":10, - "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", - "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", - "web_url":"http://git.gitlab.com/root/gitlab", - "owner":{ - "name":"Jack Smith", - "username":"jack.smith", - "id":2, - "state":"active", - "avatar_url":"http://git.gitlab.com/uploads/user/avatar/1/12586377.jpeg" - }, - "name":"gitlab", - "name_with_namespace":"Jack Smith / gitlab", - "path":"gitlab", - "path_with_namespace":"jack.smith/gitlab", - "issues_enabled":true, - "merge_requests_enabled":true, - "wiki_enabled":true, - "snippets_enabled":false, - "created_at":"2015-06-08T01:29:17.190Z", - "last_activity_at":"2015-06-08T01:29:17.190Z", - "creator_id":1, - "namespace":{ - "id":1, - "name":"jack.smith", - "path":"jack.smith", - "owner_id":2, - "created_at":"2015-05-28T19:23:40.445Z", - "updated_at":"2015-05-28T19:23:40.445Z", - "description":"", - "avatar":null - }, - "forked_from_project":{ - "id":3, - "name":"Gitlab", - "name_with_namespace":"Root / gitlab", - "path":"gitlab", - "path_with_namespace":"root/gitlab" - }, - "avatar_url":null -} diff --git a/spec/fixtures/project_hook.json b/spec/fixtures/project_hook.json deleted file mode 100644 index 180dd45..0000000 --- a/spec/fixtures/project_hook.json +++ /dev/null @@ -1 +0,0 @@ -{"id":1,"url":"https://api.example.net/v1/webhooks/ci"} diff --git a/spec/fixtures/project_hooks.json b/spec/fixtures/project_hooks.json deleted file mode 100644 index e70d412..0000000 --- a/spec/fixtures/project_hooks.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":1,"url":"https://api.example.net/v1/webhooks/ci"}] \ No newline at end of file diff --git a/spec/fixtures/project_issues.json b/spec/fixtures/project_issues.json deleted file mode 100644 index 87fb2fb..0000000 --- a/spec/fixtures/project_issues.json +++ /dev/null @@ -1 +0,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"}] \ No newline at end of file diff --git a/spec/fixtures/project_key.json b/spec/fixtures/project_key.json deleted file mode 100644 index d917f94..0000000 --- a/spec/fixtures/project_key.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "id": 2, - "title": "Key Title", - "key": "ssh-rsa ...", - "created_at": "2013-09-22T18:34:32Z" -} \ No newline at end of file diff --git a/spec/fixtures/project_keys.json b/spec/fixtures/project_keys.json deleted file mode 100644 index dd22f96..0000000 --- a/spec/fixtures/project_keys.json +++ /dev/null @@ -1,6 +0,0 @@ -[{ - "id": 2, - "title": "Key Title", - "key": "ssh-rsa ...", - "created_at": "2013-09-22T18:34:32Z" -}] \ No newline at end of file diff --git a/spec/fixtures/project_runner_enable.json b/spec/fixtures/project_runner_enable.json deleted file mode 100644 index 60c5326..0000000 --- a/spec/fixtures/project_runner_enable.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "active": true, - "description": "test-2016-02-01", - "id": 9, - "is_shared": false, - "name": null -} diff --git a/spec/fixtures/project_runners.json b/spec/fixtures/project_runners.json deleted file mode 100644 index f043a2c..0000000 --- a/spec/fixtures/project_runners.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "active": true, - "description": "test-2-20150125", - "id": 8, - "is_shared": false, - "name": null - }, - { - "active": true, - "description": "development_runner", - "id": 5, - "is_shared": true, - "name": null - } -] diff --git a/spec/fixtures/project_search.json b/spec/fixtures/project_search.json deleted file mode 100644 index 80fd4af..0000000 --- a/spec/fixtures/project_search.json +++ /dev/null @@ -1 +0,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"}] diff --git a/spec/fixtures/project_star.json b/spec/fixtures/project_star.json deleted file mode 100644 index 4e932f7..0000000 --- a/spec/fixtures/project_star.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "id": 3, - "description": null, - "default_branch": "master", - "public": false, - "visibility_level": 10, - "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", - "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", - "web_url":"http://git.gitlab.com/root/gitlab", - "tag_list": [ - - ], - "name": "GitLab Community Edition", - "name_with_namespace": "GitLab / GitLab Community Edition", - "path": "gitlab-ce", - "path_with_namespace": "gitlab/gitlab-ce", - "issues_enabled": true, - "open_issues_count": 1, - "merge_requests_enabled": true, - "builds_enabled": true, - "wiki_enabled": true, - "snippets_enabled": false, - "container_registry_enabled": false, - "created_at": "2013-09-30T13:46:02Z", - "last_activity_at": "2013-09-30T13:46:02Z", - "creator_id": 3, - "namespace": { - "created_at": "2013-09-30T13:46:02Z", - "description": "", - "id": 3, - "name": "GitLab", - "owner_id": 1, - "path": "gitlab", - "updated_at": "2013-09-30T13:46:02Z" - }, - "archived": true, - "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", - "shared_runners_enabled": true, - "forks_count": 0, - "star_count": 1, - "public_builds": true, - "shared_with_groups": [], - "only_allow_merge_if_build_succeeds": false -} diff --git a/spec/fixtures/project_tag_annotated.json b/spec/fixtures/project_tag_annotated.json deleted file mode 100644 index 3bd2070..0000000 --- a/spec/fixtures/project_tag_annotated.json +++ /dev/null @@ -1 +0,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"}} diff --git a/spec/fixtures/project_tag_lightweight.json b/spec/fixtures/project_tag_lightweight.json deleted file mode 100644 index cec1381..0000000 --- a/spec/fixtures/project_tag_lightweight.json +++ /dev/null @@ -1 +0,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"}} diff --git a/spec/fixtures/project_tags.json b/spec/fixtures/project_tags.json deleted file mode 100644 index 1e2fb96..0000000 --- a/spec/fixtures/project_tags.json +++ /dev/null @@ -1 +0,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"}}] \ No newline at end of file diff --git a/spec/fixtures/project_unstar.json b/spec/fixtures/project_unstar.json deleted file mode 100644 index 33bc36f..0000000 --- a/spec/fixtures/project_unstar.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "id": 3, - "description": null, - "default_branch": "master", - "public": false, - "visibility_level": 10, - "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", - "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", - "web_url":"http://git.gitlab.com/root/gitlab", - "tag_list": [ - - ], - "name": "GitLab Community Edition", - "name_with_namespace": "GitLab / GitLab Community Edition", - "path": "gitlab-ce", - "path_with_namespace": "gitlab/gitlab-ce", - "issues_enabled": true, - "open_issues_count": 1, - "merge_requests_enabled": true, - "builds_enabled": true, - "wiki_enabled": true, - "snippets_enabled": false, - "container_registry_enabled": false, - "created_at": "2013-09-30T13:46:02Z", - "last_activity_at": "2013-09-30T13:46:02Z", - "creator_id": 3, - "namespace": { - "created_at": "2013-09-30T13:46:02Z", - "description": "", - "id": 3, - "name": "GitLab", - "owner_id": 1, - "path": "gitlab", - "updated_at": "2013-09-30T13:46:02Z" - }, - "archived": true, - "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", - "shared_runners_enabled": true, - "forks_count": 0, - "star_count": 0, - "public_builds": true, - "shared_with_groups": [], - "only_allow_merge_if_build_succeeds": false -} diff --git a/spec/fixtures/project_update_commit_status.json b/spec/fixtures/project_update_commit_status.json deleted file mode 100644 index fd81d18..0000000 --- a/spec/fixtures/project_update_commit_status.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "id": 498, - "sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8", - "ref": "decreased-spec", - "status": "failed", - "name": "test", - "target_url": null, - "description": null, - "created_at": "2015-10-23T23:56:49.499+02:00", - "started_at": null, - "finished_at": "2015-10-23T23:56:49.534+02:00", - "author": { - "name": "Dominik Sander", - "username": "dsander", - "id": 1, - "state": "active", - "avatar_url": "https://secure.gravatar.com/avatar/xxx?s=40&d=identicon", - "web_url": "https://github.com/u/dsander" - } -} \ No newline at end of file diff --git a/spec/fixtures/projects.json b/spec/fixtures/projects.json deleted file mode 100644 index deab4c5..0000000 --- a/spec/fixtures/projects.json +++ /dev/null @@ -1 +0,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"}] \ No newline at end of file diff --git a/spec/fixtures/push_rule.json b/spec/fixtures/push_rule.json deleted file mode 100644 index 0f38ef9..0000000 --- a/spec/fixtures/push_rule.json +++ /dev/null @@ -1 +0,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} diff --git a/spec/fixtures/raw_file.json b/spec/fixtures/raw_file.json deleted file mode 100644 index 46a991f..0000000 --- a/spec/fixtures/raw_file.json +++ /dev/null @@ -1,2 +0,0 @@ -source 'https://rubygems.org' -gem 'rails', '4.1.2' diff --git a/spec/fixtures/release_create.json b/spec/fixtures/release_create.json deleted file mode 100644 index 02164aa..0000000 --- a/spec/fixtures/release_create.json +++ /dev/null @@ -1 +0,0 @@ -{"tag_name":"0.0.1","description":"Amazing release. Wow"} diff --git a/spec/fixtures/release_update.json b/spec/fixtures/release_update.json deleted file mode 100644 index 02164aa..0000000 --- a/spec/fixtures/release_update.json +++ /dev/null @@ -1 +0,0 @@ -{"tag_name":"0.0.1","description":"Amazing release. Wow"} diff --git a/spec/fixtures/repository_file.json b/spec/fixtures/repository_file.json deleted file mode 100644 index 84c3918..0000000 --- a/spec/fixtures/repository_file.json +++ /dev/null @@ -1 +0,0 @@ -{"file_path":"path","branch_name":"branch","encoding":"base64","content":"Y29udGVudA==","commit_message":"commit message"} diff --git a/spec/fixtures/run_trigger.json b/spec/fixtures/run_trigger.json deleted file mode 100644 index aa0ed2f..0000000 --- a/spec/fixtures/run_trigger.json +++ /dev/null @@ -1 +0,0 @@ -{"id":8,"variables":{"a":"10"}} diff --git a/spec/fixtures/runner.json b/spec/fixtures/runner.json deleted file mode 100644 index 4a77c32..0000000 --- a/spec/fixtures/runner.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "active": true, - "architecture": null, - "description": "test-1-20150125", - "id": 6, - "is_shared": false, - "contacted_at": "2016-01-25T16:39:48.066Z", - "name": null, - "platform": null, - "projects": [ - { - "id": 1, - "name": "GitLab Community Edition", - "name_with_namespace": "GitLab.org / GitLab Community Edition", - "path": "gitlab-ce", - "path_with_namespace": "gitlab-org/gitlab-ce" - } - ], - "token": "205086a8e3b9a2b818ffac9b89d102", - "revision": null, - "tag_list": [ - "ruby", - "mysql" - ], - "version": null -} diff --git a/spec/fixtures/runner_delete.json b/spec/fixtures/runner_delete.json deleted file mode 100644 index 5083086..0000000 --- a/spec/fixtures/runner_delete.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "active": true, - "description": "test-1-20150125-test", - "id": 6, - "is_shared": false, - "name": null -} diff --git a/spec/fixtures/runner_edit.json b/spec/fixtures/runner_edit.json deleted file mode 100644 index abb340e..0000000 --- a/spec/fixtures/runner_edit.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "active": true, - "architecture": null, - "description": "abcefg", - "id": 6, - "is_shared": false, - "contacted_at": "2016-01-25T16:39:48.066Z", - "name": null, - "platform": null, - "projects": [ - { - "id": 1, - "name": "GitLab Community Edition", - "name_with_namespace": "GitLab.org / GitLab Community Edition", - "path": "gitlab-ce", - "path_with_namespace": "gitlab-org/gitlab-ce" - } - ], - "token": "205086a8e3b9a2b818ffac9b89d102", - "revision": null, - "tag_list": [ - "ruby", - "mysql" - ], - "version": null -} diff --git a/spec/fixtures/runners.json b/spec/fixtures/runners.json deleted file mode 100644 index b8e5412..0000000 --- a/spec/fixtures/runners.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "active": true, - "description": "test-1-20150125", - "id": 6, - "is_shared": false, - "name": null - }, - { - "active": true, - "description": "test-2-20150125", - "id": 8, - "is_shared": false, - "name": null - } -] diff --git a/spec/fixtures/runners_all.json b/spec/fixtures/runners_all.json deleted file mode 100644 index 8e30e71..0000000 --- a/spec/fixtures/runners_all.json +++ /dev/null @@ -1,30 +0,0 @@ -[ - { - "active": true, - "description": "shared-runner-1", - "id": 1, - "is_shared": true, - "name": null - }, - { - "active": true, - "description": "shared-runner-2", - "id": 3, - "is_shared": true, - "name": null - }, - { - "active": true, - "description": "test-1-20150125", - "id": 6, - "is_shared": false, - "name": null - }, - { - "active": true, - "description": "test-2-20150125", - "id": 8, - "is_shared": false, - "name": null - } -] diff --git a/spec/fixtures/service.json b/spec/fixtures/service.json deleted file mode 100644 index f278652..0000000 --- a/spec/fixtures/service.json +++ /dev/null @@ -1 +0,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"}} \ No newline at end of file diff --git a/spec/fixtures/session.json b/spec/fixtures/session.json deleted file mode 100644 index e4f5ba3..0000000 --- a/spec/fixtures/session.json +++ /dev/null @@ -1 +0,0 @@ -{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z","private_token":"qEsq1pt6HJPaNciie3MG"} \ No newline at end of file diff --git a/spec/fixtures/shell_history.json b/spec/fixtures/shell_history.json deleted file mode 100644 index 8e4be8a..0000000 --- a/spec/fixtures/shell_history.json +++ /dev/null @@ -1,2 +0,0 @@ -party on, dudes -be excellent to each other diff --git a/spec/fixtures/snippet.json b/spec/fixtures/snippet.json deleted file mode 100644 index 34e9d99..0000000 --- a/spec/fixtures/snippet.json +++ /dev/null @@ -1 +0,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"} \ No newline at end of file diff --git a/spec/fixtures/snippet_award_emoji.json b/spec/fixtures/snippet_award_emoji.json deleted file mode 100644 index 666e296..0000000 --- a/spec/fixtures/snippet_award_emoji.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "id": 4, - "name": "blowfish", - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://gitlab.example.com/root" - }, - "created_at": "2016-06-15T10:09:34.206Z", - "updated_at": "2016-06-15T10:09:34.206Z", - "awardable_id": 80, - "awardable_type": "Snippet" -} \ No newline at end of file diff --git a/spec/fixtures/snippet_award_emojis.json b/spec/fixtures/snippet_award_emojis.json deleted file mode 100644 index cce5887..0000000 --- a/spec/fixtures/snippet_award_emojis.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "id": 4, - "name": "1234", - "user": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "http://gitlab.example.com/root" - }, - "created_at": "2016-06-15T10:09:34.206Z", - "updated_at": "2016-06-15T10:09:34.206Z", - "awardable_id": 80, - "awardable_type": "Snippet" - }, - { - "id": 1, - "name": "microphone", - "user": { - "name": "User 4", - "username": "user4", - "id": 26, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", - "web_url": "http://gitlab.example.com/user4" - }, - "created_at": "2016-06-15T10:09:34.177Z", - "updated_at": "2016-06-15T10:09:34.177Z", - "awardable_id": 80, - "awardable_type": "Snippet" - } -] \ No newline at end of file diff --git a/spec/fixtures/snippet_content.json b/spec/fixtures/snippet_content.json deleted file mode 100644 index e5854f9..0000000 --- a/spec/fixtures/snippet_content.json +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby - -puts "Cool snippet!" diff --git a/spec/fixtures/snippets.json b/spec/fixtures/snippets.json deleted file mode 100644 index 2645799..0000000 --- a/spec/fixtures/snippets.json +++ /dev/null @@ -1 +0,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"}] diff --git a/spec/fixtures/system_hook.json b/spec/fixtures/system_hook.json deleted file mode 100644 index 0028b7a..0000000 --- a/spec/fixtures/system_hook.json +++ /dev/null @@ -1 +0,0 @@ -{"id": 3, "url": "http://example.com/hook", "created_at": "2013-10-02T10:15:31Z"} diff --git a/spec/fixtures/system_hooks.json b/spec/fixtures/system_hooks.json deleted file mode 100644 index 2b58791..0000000 --- a/spec/fixtures/system_hooks.json +++ /dev/null @@ -1 +0,0 @@ -[{"id": 3, "url": "http://example.com/hook", "created_at": "2013-10-02T10:15:31Z"}] diff --git a/spec/fixtures/tag.json b/spec/fixtures/tag.json deleted file mode 100644 index 1a95113..0000000 --- a/spec/fixtures/tag.json +++ /dev/null @@ -1 +0,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} diff --git a/spec/fixtures/tag_create.json b/spec/fixtures/tag_create.json deleted file mode 100644 index 60e599b..0000000 --- a/spec/fixtures/tag_create.json +++ /dev/null @@ -1 +0,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"}} diff --git a/spec/fixtures/tag_create_with_description.json b/spec/fixtures/tag_create_with_description.json deleted file mode 100644 index 76ce879..0000000 --- a/spec/fixtures/tag_create_with_description.json +++ /dev/null @@ -1 +0,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} diff --git a/spec/fixtures/tag_delete.json b/spec/fixtures/tag_delete.json deleted file mode 100644 index 9eb1f86..0000000 --- a/spec/fixtures/tag_delete.json +++ /dev/null @@ -1 +0,0 @@ -{"tag_name":"0.0.1"} diff --git a/spec/fixtures/tags.json b/spec/fixtures/tags.json deleted file mode 100644 index 32fd6b1..0000000 --- a/spec/fixtures/tags.json +++ /dev/null @@ -1 +0,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}] diff --git a/spec/fixtures/team_member.json b/spec/fixtures/team_member.json deleted file mode 100644 index fd3ac38..0000000 --- a/spec/fixtures/team_member.json +++ /dev/null @@ -1 +0,0 @@ -{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z","access_level":40} \ No newline at end of file diff --git a/spec/fixtures/team_members.json b/spec/fixtures/team_members.json deleted file mode 100644 index a2fe19e..0000000 --- a/spec/fixtures/team_members.json +++ /dev/null @@ -1 +0,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}] \ No newline at end of file diff --git a/spec/fixtures/todo.json b/spec/fixtures/todo.json deleted file mode 100644 index deff6fb..0000000 --- a/spec/fixtures/todo.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "id": 102, - "project": { - "id": 2, - "name": "Gitlab Ce", - "name_with_namespace": "Gitlab Org / Gitlab Ce", - "path": "gitlab-ce", - "path_with_namespace": "gitlab-org/gitlab-ce" - }, - "author": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "https://gitlab.example.com/root" - }, - "action_name": "marked", - "target_type": "MergeRequest", - "target": { - "id": 34, - "iid": 7, - "project_id": 2, - "title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", - "description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.", - "state": "opened", - "created_at": "2016-06-17T07:49:24.419Z", - "updated_at": "2016-06-17T07:52:43.484Z", - "target_branch": "tutorials_git_tricks", - "source_branch": "DNSBL_docs", - "upvotes": 0, - "downvotes": 0, - "author": { - "name": "Maxie Medhurst", - "username": "craig_rutherford", - "id": 12, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon", - "web_url": "https://gitlab.example.com/craig_rutherford" - }, - "assignee": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "https://gitlab.example.com/root" - }, - "source_project_id": 2, - "target_project_id": 2, - "labels": [], - "work_in_progress": false, - "milestone": { - "id": 32, - "iid": 2, - "project_id": 2, - "title": "v1.0", - "description": "Assumenda placeat ea voluptatem voluptate qui.", - "state": "active", - "created_at": "2016-06-17T07:47:34.163Z", - "updated_at": "2016-06-17T07:47:34.163Z", - "due_date": null - }, - "merge_when_pipeline_succeeds": false, - "merge_status": "cannot_be_merged", - "subscribed": true, - "user_notes_count": 7 - }, - "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ce/merge_requests/7", - "body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", - "state": "done", - "created_at": "2016-06-17T07:52:35.225Z" -} \ No newline at end of file diff --git a/spec/fixtures/todos.json b/spec/fixtures/todos.json deleted file mode 100644 index 98a7db3..0000000 --- a/spec/fixtures/todos.json +++ /dev/null @@ -1,148 +0,0 @@ -[ - { - "id": 102, - "project": { - "id": 2, - "name": "Gitlab Ce", - "name_with_namespace": "Gitlab Org / Gitlab Ce", - "path": "gitlab-ce", - "path_with_namespace": "gitlab-org/gitlab-ce" - }, - "author": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "https://gitlab.example.com/root" - }, - "action_name": "marked", - "target_type": "MergeRequest", - "target": { - "id": 34, - "iid": 7, - "project_id": 2, - "title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", - "description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.", - "state": "opened", - "created_at": "2016-06-17T07:49:24.419Z", - "updated_at": "2016-06-17T07:52:43.484Z", - "target_branch": "tutorials_git_tricks", - "source_branch": "DNSBL_docs", - "upvotes": 0, - "downvotes": 0, - "author": { - "name": "Maxie Medhurst", - "username": "craig_rutherford", - "id": 12, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon", - "web_url": "https://gitlab.example.com/craig_rutherford" - }, - "assignee": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "https://gitlab.example.com/root" - }, - "source_project_id": 2, - "target_project_id": 2, - "labels": [], - "work_in_progress": false, - "milestone": { - "id": 32, - "iid": 2, - "project_id": 2, - "title": "v1.0", - "description": "Assumenda placeat ea voluptatem voluptate qui.", - "state": "active", - "created_at": "2016-06-17T07:47:34.163Z", - "updated_at": "2016-06-17T07:47:34.163Z", - "due_date": null - }, - "merge_when_pipeline_succeeds": false, - "merge_status": "cannot_be_merged", - "subscribed": true, - "user_notes_count": 7 - }, - "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ce/merge_requests/7", - "body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", - "state": "pending", - "created_at": "2016-06-17T07:52:35.225Z" - }, - { - "id": 98, - "project": { - "id": 2, - "name": "Gitlab Ce", - "name_with_namespace": "Gitlab Org / Gitlab Ce", - "path": "gitlab-ce", - "path_with_namespace": "gitlab-org/gitlab-ce" - }, - "author": { - "name": "Maxie Medhurst", - "username": "craig_rutherford", - "id": 12, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon", - "web_url": "https://gitlab.example.com/craig_rutherford" - }, - "action_name": "assigned", - "target_type": "MergeRequest", - "target": { - "id": 34, - "iid": 7, - "project_id": 2, - "title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", - "description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.", - "state": "opened", - "created_at": "2016-06-17T07:49:24.419Z", - "updated_at": "2016-06-17T07:52:43.484Z", - "target_branch": "tutorials_git_tricks", - "source_branch": "DNSBL_docs", - "upvotes": 0, - "downvotes": 0, - "author": { - "name": "Maxie Medhurst", - "username": "craig_rutherford", - "id": 12, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon", - "web_url": "https://gitlab.example.com/craig_rutherford" - }, - "assignee": { - "name": "Administrator", - "username": "root", - "id": 1, - "state": "active", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", - "web_url": "https://gitlab.example.com/root" - }, - "source_project_id": 2, - "target_project_id": 2, - "labels": [], - "work_in_progress": false, - "milestone": { - "id": 32, - "iid": 2, - "project_id": 2, - "title": "v1.0", - "description": "Assumenda placeat ea voluptatem voluptate qui.", - "state": "active", - "created_at": "2016-06-17T07:47:34.163Z", - "updated_at": "2016-06-17T07:47:34.163Z", - "due_date": null - }, - "merge_when_pipeline_succeeds": false, - "merge_status": "cannot_be_merged", - "subscribed": true, - "user_notes_count": 7 - }, - "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ce/merge_requests/7", - "body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", - "state": "pending", - "created_at": "2016-06-17T07:49:24.624Z" - } -] \ No newline at end of file diff --git a/spec/fixtures/tree.json b/spec/fixtures/tree.json deleted file mode 100644 index fe734e9..0000000 --- a/spec/fixtures/tree.json +++ /dev/null @@ -1 +0,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"}] diff --git a/spec/fixtures/trigger.json b/spec/fixtures/trigger.json deleted file mode 100644 index d0657df..0000000 --- a/spec/fixtures/trigger.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "id": 10, - "description": "my trigger", - "created_at": "2016-01-07T09:53:58.235Z", - "deleted_at": null, - "last_used": null, - "token": "6d056f63e50fe6f8c5f8f4aa10edb7", - "updated_at": "2016-01-07T09:53:58.235Z", - "owner": null -} diff --git a/spec/fixtures/triggers.json b/spec/fixtures/triggers.json deleted file mode 100644 index 35218b5..0000000 --- a/spec/fixtures/triggers.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "id": 10, - "description": "my trigger", - "created_at": "2016-01-07T09:53:58.235Z", - "deleted_at": null, - "last_used": null, - "token": "6d056f63e50fe6f8c5f8f4aa10edb7", - "updated_at": "2016-01-07T09:53:58.235Z", - "owner": null - } -] diff --git a/spec/fixtures/user.json b/spec/fixtures/user.json deleted file mode 100644 index a7c7afb..0000000 --- a/spec/fixtures/user.json +++ /dev/null @@ -1 +0,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"} \ No newline at end of file diff --git a/spec/fixtures/user_block_unblock.json b/spec/fixtures/user_block_unblock.json deleted file mode 100644 index f32a580..0000000 --- a/spec/fixtures/user_block_unblock.json +++ /dev/null @@ -1 +0,0 @@ -true \ No newline at end of file diff --git a/spec/fixtures/user_email.json b/spec/fixtures/user_email.json deleted file mode 100644 index dee81fe..0000000 --- a/spec/fixtures/user_email.json +++ /dev/null @@ -1 +0,0 @@ -{"id":1,"email":"email@example.com"} \ No newline at end of file diff --git a/spec/fixtures/user_emails.json b/spec/fixtures/user_emails.json deleted file mode 100644 index f016dc4..0000000 --- a/spec/fixtures/user_emails.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":1,"email":"email@example.com"},{"id":3,"email":"email2@example.com"}] \ No newline at end of file diff --git a/spec/fixtures/user_search.json b/spec/fixtures/user_search.json deleted file mode 100644 index 020c82f..0000000 --- a/spec/fixtures/user_search.json +++ /dev/null @@ -1 +0,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"}] \ No newline at end of file diff --git a/spec/fixtures/users.json b/spec/fixtures/users.json deleted file mode 100644 index 2695d4b..0000000 --- a/spec/fixtures/users.json +++ /dev/null @@ -1 +0,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"}] \ No newline at end of file diff --git a/spec/fixtures/variable.json b/spec/fixtures/variable.json deleted file mode 100644 index 4550c49..0000000 --- a/spec/fixtures/variable.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "key": "VARIABLE", - "value": "the value" -} diff --git a/spec/fixtures/variables.json b/spec/fixtures/variables.json deleted file mode 100644 index 94eea18..0000000 --- a/spec/fixtures/variables.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "key": "TEST_VARIABLE_1", - "value": "TEST_1" - }, - { - "key": "TEST_VARIABLE_2", - "value": "TEST_2" - } -] diff --git a/spec/gitlab/cli_helpers_spec.rb b/spec/gitlab/cli_helpers_spec.rb deleted file mode 100644 index 7224148..0000000 --- a/spec/gitlab/cli_helpers_spec.rb +++ /dev/null @@ -1,57 +0,0 @@ -require 'spec_helper' - -describe Gitlab::CLI::Helpers do - describe ".method_owners" do - before do - @methods = Gitlab::CLI::Helpers.method_owners - end - it "should return Array of Hashes containing method names and owners" do - expect(@methods).to be_a Array - expect(@methods.all? { |m| m.is_a? Hash }).to be true - expect(@methods.all? { |m| m.keys.sort === [:name, :owner] }).to be true - end - end - - describe ".valid_command?" do - it "should return true when command is valid" do - expect(Gitlab::CLI::Helpers.valid_command? 'merge_requests').to be_truthy - end - it "should return false when command is NOT valid" do - expect(Gitlab::CLI::Helpers.valid_command? 'mmmmmerge_requests').to be_falsy - end - end - - describe ".symbolize_keys" do - context "when input is a Hash" do - it "should return a Hash with symbols for keys" do - hash = { 'key1' => 'val1', 'key2' => 'val2' } - symbolized_hash = Gitlab::CLI::Helpers.symbolize_keys(hash) - expect(symbolized_hash).to eq(key1: 'val1', key2: 'val2') - end - end - context "when input is NOT a Hash" do - it "should return input untouched" do - array = [1, 2, 3] - new_array = Gitlab::CLI::Helpers.symbolize_keys(array) - expect(new_array).to eq([1, 2, 3]) - end - end - end - - describe ".yaml_load" do - context "when argument is a YAML string" do - it "should return Ruby objects" do - argument = "{foo: bar, sna: fu}" - output = Gitlab::CLI::Helpers.yaml_load argument - expect(output).to eq('foo' => 'bar', 'sna' => 'fu') - end - end - - context "when input is NOT valid YAML" do - it "should raise" do - ruby_array = [1, 2, 3, 4] - expect { Gitlab::CLI::Helpers.yaml_load ruby_array }.to raise_error TypeError - end - end - end -end diff --git a/spec/gitlab/cli_spec.rb b/spec/gitlab/cli_spec.rb deleted file mode 100644 index b3d6384..0000000 --- a/spec/gitlab/cli_spec.rb +++ /dev/null @@ -1,119 +0,0 @@ -require 'spec_helper' -require 'json' - -describe Gitlab::CLI do - describe ".run" do - context "when command is version" do - it "should show gem version" do - output = capture_output { Gitlab::CLI.run('-v') } - expect(output).to eq("Gitlab Ruby Gem #{Gitlab::VERSION}\n") - end - end - - context "when command is info" do - it "should show environment info" do - output = capture_output { Gitlab::CLI.run('info') } - expect(output).to include("Gitlab endpoint is") - expect(output).to include("Gitlab private token is") - expect(output).to include("Ruby Version is") - expect(output).to include("Gitlab Ruby Gem") - end - end - - context "when command is help" do - it "should show available actions" do - output = capture_output { Gitlab::CLI.run('help') } - expect(output).to include('Help Topics') - expect(output).to include('MergeRequests') - end - end - - context "when command is user" do - before do - stub_get("/user", "user") - @output = capture_output { Gitlab::CLI.run('user') } - end - - it "should show executed command" do - expect(@output).to include('Gitlab.user') - end - - it "should show user data" do - expect(@output).to include('name') - expect(@output).to include('John Smith') - end - end - - context "when command is users" do - before do - stub_get("/users", "users") - @output = capture_output { Gitlab::CLI.run('users') } - end - - it "should show executed command" do - expect(@output).to include('Gitlab.users') - end - - it "should show users data" do - expect(@output).to include('name') - expect(@output).to include('John Smith') - expect(@output).to include('Jack Smith') - end - end - end - - describe ".start" do - context "when command with excluded fields" do - before do - stub_get("/user", "user") - args = ['user', '--except=id,email,name'] - @output = capture_output { Gitlab::CLI.start(args) } - end - - it "should show user data with excluded fields" do - expect(@output).to_not include('John Smith') - expect(@output).to include('bio') - expect(@output).to include('created_at') - end - end - - context "when command with json output" do - before do - stub_get("/user", "user") - args = ['user', '--json'] - @output = capture_output { Gitlab::CLI.start(args) } - end - - it "should render output as json" do - expect(JSON.parse(@output)['result']).to eq(JSON.parse(File.read(File.dirname(__FILE__) + '/../fixtures/user.json'))) - expect(JSON.parse(@output)['cmd']).to eq('Gitlab.user') - end - end - - context "when command with required fields" do - before do - stub_get("/user", "user") - args = ['user', '--only=id,email,name'] - @output = capture_output { Gitlab::CLI.start(args) } - end - - it "should show user data with required fields" do - expect(@output).to include('id') - expect(@output).to include('name') - expect(@output).to include('email') - expect(@output).to include('John Smith') - expect(@output).to_not include('bio') - expect(@output).to_not include('created_at') - end - end - - context "fetch project with namespace/repo" do - it "should encode delimiter" do - stub_get("/projects/gitlab-org%2Fgitlab-ce", "project") - args = ['project', 'gitlab-org/gitlab-ce'] - @output = capture_output { Gitlab::CLI.start(args) } - expect(@output).to include('id') - end - end - end -end diff --git a/spec/gitlab/client/award_emojis_spec.rb b/spec/gitlab/client/award_emojis_spec.rb deleted file mode 100644 index 9acbdf4..0000000 --- a/spec/gitlab/client/award_emojis_spec.rb +++ /dev/null @@ -1,391 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe '.award_emojis' do - context 'when issue award emojis' do - before do - stub_get("/projects/1/issues/80/award_emoji", "issue_award_emojis") - @emojis = Gitlab.award_emojis(1, 80, 'issue') - end - - it "should get the correct resources" do - expect(a_get("/projects/1/issues/80/award_emoji")).to have_been_made - end - - it "should return a paginated response of issue award emojis" do - expect(@emojis).to be_a Gitlab::PaginatedResponse - expect(@emojis.first.awardable_id).to eq(80) - expect(@emojis.first.awardable_type).to eq("Issue") - end - end - - context 'when merge request award emojis' do - before do - stub_get("/projects/1/merge_requests/80/award_emoji", "merge_request_award_emojis") - @emojis = Gitlab.award_emojis(1, 80, 'merge_request') - end - - it "should get the correct resources" do - expect(a_get("/projects/1/merge_requests/80/award_emoji")).to have_been_made - end - - it "should return a paginated response of merge request award emojis" do - expect(@emojis).to be_a Gitlab::PaginatedResponse - expect(@emojis.first.awardable_id).to eq(80) - expect(@emojis.first.awardable_type).to eq("MergeRequest") - end - end - - context 'when snippet award emojis' do - before do - stub_get("/projects/1/snippets/80/award_emoji", "snippet_award_emojis") - @emojis = Gitlab.award_emojis(1, 80, 'snippet') - end - - it "should get the correct resources" do - expect(a_get("/projects/1/snippets/80/award_emoji")).to have_been_made - end - - it "should return a paginated response of snippet award emojis" do - expect(@emojis).to be_a Gitlab::PaginatedResponse - expect(@emojis.first.awardable_id).to eq(80) - expect(@emojis.first.awardable_type).to eq("Snippet") - end - end - end - - describe '.note_award_emojis' do - context 'when issue note award emojis' do - before do - stub_get("/projects/1/issues/80/notes/1/award_emoji", "note_award_emojis") - @note_emojis = Gitlab.note_award_emojis(1, 80, 'issue', 1) - end - - it "should get the correct resources" do - expect(a_get("/projects/1/issues/80/notes/1/award_emoji")).to have_been_made - end - - it "should return a paginated response of issue note award emojis" do - expect(@note_emojis).to be_a Gitlab::PaginatedResponse - expect(@note_emojis.first.awardable_id).to eq(1) - expect(@note_emojis.first.awardable_type).to eq("Note") - end - end - - context 'when merge request note award emojis' do - before do - stub_get("/projects/1/merge_requests/80/notes/1/award_emoji", "note_award_emojis") - @note_emojis = Gitlab.note_award_emojis(1, 80, 'merge_request', 1) - end - - it "should get the correct resources" do - expect(a_get("/projects/1/merge_requests/80/notes/1/award_emoji")).to have_been_made - end - - it "should return a paginated response of merge request note award emojis" do - expect(@note_emojis).to be_a Gitlab::PaginatedResponse - expect(@note_emojis.first.awardable_id).to eq(1) - expect(@note_emojis.first.awardable_type).to eq("Note") - end - end - - context 'when snippet note award emojis' do - before do - stub_get("/projects/1/snippets/80/notes/1/award_emoji", "note_award_emojis") - @note_emojis = Gitlab.note_award_emojis(1, 80, 'snippet', 1) - end - - it "should get the correct resources" do - expect(a_get("/projects/1/snippets/80/notes/1/award_emoji")).to have_been_made - end - - it "should return a paginated response of snippet note award emojis" do - expect(@note_emojis).to be_a Gitlab::PaginatedResponse - expect(@note_emojis.first.awardable_id).to eq(1) - expect(@note_emojis.first.awardable_type).to eq("Note") - end - end - end - - describe '.award_emoji' do - context 'when issue award emoji' do - before do - stub_get("/projects/1/issues/80/award_emoji/4", "issue_award_emoji") - @emoji = Gitlab.award_emoji(1, 80, 'issue', 4) - end - - it "should get the correct resource" do - expect(a_get("/projects/1/issues/80/award_emoji/4")).to have_been_made - end - - it "should return information about an issue award emoji" do - expect(@emoji.id).to eq(4) - expect(@emoji.awardable_type).to eq("Issue") - expect(@emoji.awardable_id).to eq(80) - end - end - - context 'when merge request award emoji' do - before do - stub_get("/projects/1/merge_requests/80/award_emoji/4", "merge_request_award_emoji") - @emoji = Gitlab.award_emoji(1, 80, 'merge_request', 4) - end - - it "should get the correct resource" do - expect(a_get("/projects/1/merge_requests/80/award_emoji/4")).to have_been_made - end - - it "should return information about a merge request award emoji" do - expect(@emoji.id).to eq(4) - expect(@emoji.awardable_type).to eq("MergeRequest") - expect(@emoji.awardable_id).to eq(80) - end - end - - context 'when snippet award emoji' do - before do - stub_get("/projects/1/snippets/80/award_emoji/4", "snippet_award_emoji") - @emoji = Gitlab.award_emoji(1, 80, 'snippet', 4) - end - - it "should get the correct resource" do - expect(a_get("/projects/1/snippets/80/award_emoji/4")).to have_been_made - end - - it "should return information about a snippet award emoji" do - expect(@emoji.id).to eq(4) - expect(@emoji.awardable_type).to eq("Snippet") - expect(@emoji.awardable_id).to eq(80) - end - end - end - - describe '.note_award_emoji' do - context 'when issue note award emoji' do - before do - stub_get("/projects/1/issues/80/notes/1/award_emoji/4", "note_award_emoji") - @note_emoji = Gitlab.note_award_emoji(1, 80, 'issue', 1, 4) - end - - it "should get the correct resource" do - expect(a_get("/projects/1/issues/80/notes/1/award_emoji/4")).to have_been_made - end - - it "should return information about an issue note award emoji" do - expect(@note_emoji.id).to eq(4) - expect(@note_emoji.awardable_type).to eq("Note") - expect(@note_emoji.awardable_id).to eq(1) - end - end - - context 'when merge request note award emoji' do - before do - stub_get("/projects/1/merge_requests/80/notes/1/award_emoji/4", "note_award_emoji") - @note_emoji = Gitlab.note_award_emoji(1, 80, 'merge_request', 1, 4) - end - - it "should get the correct resource" do - expect(a_get("/projects/1/merge_requests/80/notes/1/award_emoji/4")).to have_been_made - end - - it "should return information about a merge request note award emoji" do - expect(@note_emoji.id).to eq(4) - expect(@note_emoji.awardable_type).to eq("Note") - expect(@note_emoji.awardable_id).to eq(1) - end - end - - context 'when snippet note award emoji' do - before do - stub_get("/projects/1/snippets/80/notes/1/award_emoji/4", "note_award_emoji") - @note_emoji = Gitlab.note_award_emoji(1, 80, 'snippet', 1, 4) - end - - it "should get the correct resource" do - expect(a_get("/projects/1/snippets/80/notes/1/award_emoji/4")).to have_been_made - end - - it "should return information about a snippet note award emoji" do - expect(@note_emoji.id).to eq(4) - expect(@note_emoji.awardable_type).to eq("Note") - expect(@note_emoji.awardable_id).to eq(1) - end - end - end - - describe '.create_award_emoji' do - context 'when issue award emoji' do - before do - stub_post("/projects/1/issues/80/award_emoji", "issue_award_emoji") - @emoji = Gitlab.create_award_emoji(1, 80, "issue", "blowfish") - end - - it "should get the correct resource" do - expect(a_post("/projects/1/issues/80/award_emoji"). - with(body: { name: 'blowfish' })).to have_been_made - end - - it "should return correct information about the created issue award emoji" do - expect(@emoji.name).to eq('blowfish') - expect(@emoji.awardable_type).to eq('Issue') - end - end - - context 'when merge request award emoji' do - before do - stub_post("/projects/1/merge_requests/80/award_emoji", "merge_request_award_emoji") - @emoji = Gitlab.create_award_emoji(1, 80, "merge_request", "blowfish") - end - - it "should get the correct resource" do - expect(a_post("/projects/1/merge_requests/80/award_emoji"). - with(body: { name: 'blowfish' })).to have_been_made - end - - it "should return correct information about the created merge request award emoji" do - expect(@emoji.name).to eq('blowfish') - expect(@emoji.awardable_type).to eq('MergeRequest') - end - end - - context 'when snippet award emoji' do - before do - stub_post("/projects/1/snippets/80/award_emoji", "snippet_award_emoji") - @emoji = Gitlab.create_award_emoji(1, 80, "snippet", "blowfish") - end - - it "should get the correct resource" do - expect(a_post("/projects/1/snippets/80/award_emoji"). - with(body: { name: 'blowfish' })).to have_been_made - end - - it "should return correct information about the created snippet award emoji" do - expect(@emoji.name).to eq('blowfish') - expect(@emoji.awardable_type).to eq('Snippet') - end - end - end - - describe '.create_note_award_emoji' do - context 'when issue note award emoji' do - before do - stub_post("/projects/1/issues/80/notes/1/award_emoji", "note_award_emoji") - @note_emoji = Gitlab.create_note_award_emoji(1, 80, "issue", 1, "mood_bubble_lightning") - end - - it "should get the correct resource" do - expect(a_post("/projects/1/issues/80/notes/1/award_emoji"). - with(body: { name: 'mood_bubble_lightning' })).to have_been_made - end - - it "should return correct information about the created issue note award emoji" do - expect(@note_emoji.name).to eq('mood_bubble_lightning') - expect(@note_emoji.awardable_type).to eq('Note') - end - end - - context 'when merge request note award emoji' do - before do - stub_post("/projects/1/merge_requests/80/notes/1/award_emoji", "note_award_emoji") - @note_emoji = Gitlab.create_note_award_emoji(1, 80, "merge_request", 1, "mood_bubble_lightning") - end - - it "should get the correct resource" do - expect(a_post("/projects/1/merge_requests/80/notes/1/award_emoji"). - with(body: { name: 'mood_bubble_lightning' })).to have_been_made - end - - it "should return correct information about the created merge request note award emoji" do - expect(@note_emoji.name).to eq('mood_bubble_lightning') - expect(@note_emoji.awardable_type).to eq('Note') - end - end - - context 'when snippet note award emoji' do - before do - stub_post("/projects/1/snippets/80/notes/1/award_emoji", "note_award_emoji") - @note_emoji = Gitlab.create_note_award_emoji(1, 80, "snippet", 1, "mood_bubble_lightning") - end - - it "should get the correct resource" do - expect(a_post("/projects/1/snippets/80/notes/1/award_emoji"). - with(body: { name: 'mood_bubble_lightning' })).to have_been_made - end - - it "should return correct information about the created snippet note award emoji" do - expect(@note_emoji.name).to eq('mood_bubble_lightning') - expect(@note_emoji.awardable_type).to eq('Note') - end - end - end - - describe '.delete_award_emoji' do - context 'when issue award emoji' do - before do - stub_delete("/projects/1/issues/80/award_emoji/4", "issue_award_emoji") - @emoji = Gitlab.delete_award_emoji(1, 80, "issue", 4) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/issues/80/award_emoji/4")).to have_been_made - end - end - - context 'when merge request award emoji' do - before do - stub_delete("/projects/1/merge_requests/80/award_emoji/4", "merge_request_award_emoji") - @emoji = Gitlab.delete_award_emoji(1, 80, "merge_request", 4) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/merge_requests/80/award_emoji/4")).to have_been_made - end - end - - context 'when snippet award emoji' do - before do - stub_delete("/projects/1/snippets/80/award_emoji/4", "snippet_award_emoji") - @emoji = Gitlab.delete_award_emoji(1, 80, "snippet", 4) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/snippets/80/award_emoji/4")).to have_been_made - end - end - end - - describe '.delete_note_award_emoji' do - context 'when issue note award emoji' do - before do - stub_delete("/projects/1/issues/80/notes/1/award_emoji/4", "note_award_emoji") - @note_emoji = Gitlab.delete_note_award_emoji(1, 80, "issue", 1, 4) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/issues/80/notes/1/award_emoji/4")).to have_been_made - end - end - - context 'when merge request note award emoji' do - before do - stub_delete("/projects/1/merge_requests/80/notes/1/award_emoji/4", "note_award_emoji") - @note_emoji = Gitlab.delete_note_award_emoji(1, 80, "merge_request", 1, 4) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/merge_requests/80/notes/1/award_emoji/4")).to have_been_made - end - end - - context 'when snippet note award emoji' do - before do - stub_delete("/projects/1/snippets/80/notes/1/award_emoji/4", "note_award_emoji") - @note_emoji = Gitlab.delete_note_award_emoji(1, 80, "snippet", 1, 4) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/snippets/80/notes/1/award_emoji/4")).to have_been_made - end - end - end -end \ No newline at end of file diff --git a/spec/gitlab/client/boards_spec.rb b/spec/gitlab/client/boards_spec.rb deleted file mode 100644 index 7eb86b1..0000000 --- a/spec/gitlab/client/boards_spec.rb +++ /dev/null @@ -1,94 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".boards" do - before do - stub_get("/projects/3/boards", "boards") - @boards = Gitlab.boards(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/boards")).to have_been_made - end - - it "should return a paginated response of project's boards" do - expect(@boards).to be_a Gitlab::PaginatedResponse - end - end - - describe ".board_lists" do - before do - stub_get("/projects/3/boards/1/lists", "board_lists") - @board_lists = Gitlab.board_lists(3, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/boards/1/lists")).to have_been_made - end - - it "should return a paginated response of board's lists" do - expect(@board_lists).to be_a Gitlab::PaginatedResponse - expect(@board_lists.first.id).to eq(1) - end - end - - describe ".board_list" do - before do - stub_get("/projects/3/boards/1/lists/1", "board_list") - @board_list = Gitlab.board_list(3, 1, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/boards/1/lists/1")).to have_been_made - end - - it "should return information about the list" do - expect(@board_list.id).to eq(1) - end - end - - describe ".create_board_list" do - before do - stub_post("/projects/3/boards/1/lists", "board_list") - @board_list = Gitlab.create_board_list(3, 1, 4) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/boards/1/lists")).to have_been_made - end - - it "should return information about a created board" do - expect(@board_list.position).to eq(1) - end - end - - describe ".edit_board_list" do - before do - stub_put("/projects/3/boards/1/lists/1", "board_list") - @board_list = Gitlab.edit_board_list(3, 1, 1, 3) - end - - it "should get the correct resource" do - expect(a_put("/projects/3/boards/1/lists/1")).to have_been_made - end - - it "should return information about an edited board" do - expect(@board_list.id).to eq(1) - end - end - - describe ".delete_board_list" do - before do - stub_delete("/projects/3/boards/1/lists/1", "board_list") - @board_list = Gitlab.delete_board_list(3, 1, 1) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/boards/1/lists/1")).to have_been_made - end - - it "should return information about the deleted board list" do - expect(@board_list.id).to eq(1) - end - end -end diff --git a/spec/gitlab/client/branches_spec.rb b/spec/gitlab/client/branches_spec.rb deleted file mode 100644 index b21e08a..0000000 --- a/spec/gitlab/client/branches_spec.rb +++ /dev/null @@ -1,116 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - it { should respond_to :repo_branches } - it { should respond_to :repo_branch } - it { should respond_to :repo_protect_branch } - it { should respond_to :repo_unprotect_branch } - - describe ".branches" do - before do - stub_get("/projects/3/repository/branches", "branches") - @branches = Gitlab.branches(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/branches")).to have_been_made - end - - it "should return a paginated response of repository branches" do - expect(@branches).to be_a Gitlab::PaginatedResponse - expect(@branches.first.name).to eq("api") - end - end - - describe ".branch" do - before do - stub_get("/projects/3/repository/branches/api", "branch") - @branch = Gitlab.branch(3, "api") - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/branches/api")).to have_been_made - end - - it "should return information about a repository branch" do - expect(@branch.name).to eq("api") - end - end - - describe ".protect_branch" do - before do - stub_put("/projects/3/repository/branches/api/protect", "branch") - end - - context "without options" do - before do - @branch = Gitlab.protect_branch(3, "api") - end - - it "should update the correct resource" do - expect(a_put("/projects/3/repository/branches/api/protect")).to have_been_made - end - - it "should return information about a protected repository branch" do - expect(@branch.name).to eq("api") - end - end - - context "with options" do - before do - @branch = Gitlab.protect_branch(3, "api", developers_can_push: true) - end - - it "should update the correct resource with the correct options" do - expect( - a_put("/projects/3/repository/branches/api/protect").with(body: { developers_can_push: 'true' }) - ).to have_been_made - end - end - end - - describe ".unprotect_branch" do - before do - stub_put("/projects/3/repository/branches/api/unprotect", "branch") - @branch = Gitlab.unprotect_branch(3, "api") - end - - it "should get the correct resource" do - expect(a_put("/projects/3/repository/branches/api/unprotect")).to have_been_made - end - - it "should return information about an unprotected repository branch" do - expect(@branch.name).to eq("api") - end - end - - describe ".create_branch" do - before do - stub_post("/projects/3/repository/branches", "branch") - @branch = Gitlab.create_branch(3, "api", "master") - end - - it "should get the correct resource" do - expect(a_post("/projects/3/repository/branches")).to have_been_made - end - - it "should return information about a new repository branch" do - expect(@branch.name).to eq("api") - end - end - - describe ".delete_branch" do - before do - stub_delete("/projects/3/repository/branches/api", "branch_delete") - @branch = Gitlab.delete_branch(3, "api") - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/repository/branches/api")).to have_been_made - end - - it "should return information about the deleted repository branch" do - expect(@branch.branch_name).to eq("api") - end - end -end diff --git a/spec/gitlab/client/build_variables_spec.rb b/spec/gitlab/client/build_variables_spec.rb deleted file mode 100644 index 83cf117..0000000 --- a/spec/gitlab/client/build_variables_spec.rb +++ /dev/null @@ -1,86 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".variables" do - before do - stub_get("/projects/3/variables", "variables") - @variables = Gitlab.variables(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/variables")).to have_been_made - end - - it "should return an array of project's variables" do - expect(@variables).to be_a Gitlab::PaginatedResponse - expect(@variables.first.key).to eq("TEST_VARIABLE_1") - expect(@variables.first.value).to eq("TEST_1") - end - end - - describe ".variable" do - before do - stub_get("/projects/3/variables/VARIABLE", "variable") - @variable = Gitlab.variable(3, "VARIABLE") - end - - it "should get the correct resource" do - expect(a_get("/projects/3/variables/VARIABLE")).to have_been_made - end - - it "should return information about a variable" do - expect(@variable.key).to eq("VARIABLE") - expect(@variable.value).to eq("the value") - end - end - - describe ".create_variable" do - before do - stub_post("/projects/3/variables", "variable") - @variable = Gitlab.create_variable(3, "NEW_VARIABLE", "new value") - end - - it "should get the correct resource" do - body = { key: "NEW_VARIABLE", value: "new value" } - expect(a_post("/projects/3/variables").with(body: body)).to have_been_made - end - - it "should return information about a new variable" do - expect(@variable.key).to eq("VARIABLE") - expect(@variable.value).to eq("the value") - end - end - - describe ".update_variable" do - before do - stub_put("/projects/3/variables/UPD_VARIABLE", "variable") - @variable = Gitlab.update_variable(3, "UPD_VARIABLE", "updated value") - end - - it "should put the correct resource" do - body = { value: "updated value" } - expect(a_put("/projects/3/variables/UPD_VARIABLE").with(body: body)).to have_been_made - end - - it "should return information about an updated variable" do - expect(@variable.key).to eq("VARIABLE") - expect(@variable.value).to eq("the value") - end - end - - describe ".remove_variable" do - before do - stub_delete("/projects/3/variables/DEL_VARIABLE", "variable") - @variable = Gitlab.remove_variable(3, "DEL_VARIABLE") - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/variables/DEL_VARIABLE")).to have_been_made - end - - it "should return information about a deleted variable" do - expect(@variable.key).to eq("VARIABLE") - expect(@variable.value).to eq("the value") - end - end -end diff --git a/spec/gitlab/client/builds_spec.rb b/spec/gitlab/client/builds_spec.rb deleted file mode 100644 index 1c8d229..0000000 --- a/spec/gitlab/client/builds_spec.rb +++ /dev/null @@ -1,148 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".builds" do - before do - stub_get("/projects/3/builds", "builds") - @builds = Gitlab.builds(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/builds")).to have_been_made - end - - it "should return a paginated response of project's builds" do - expect(@builds).to be_a Gitlab::PaginatedResponse - end - end - - describe ".build" do - before do - stub_get("/projects/3/builds/8", "build") - @build = Gitlab.build(3, 8) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/builds/8")).to have_been_made - end - - it "should return a single build" do - expect(@build).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about a build" do - expect(@build.id).to eq(8) - expect(@build.user.name).to eq("John Smith") - end - end - - describe ".build_artifacts" do - context "when successful request" do - before do - fixture = load_fixture('build_artifacts') - fixture.set_encoding(Encoding::ASCII_8BIT) - stub_request(:get, "#{Gitlab.endpoint}/projects/3/builds/8/artifacts"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }). - to_return(body: fixture.read, headers: { 'Content-Disposition' => "attachment; filename=artifacts.zip" }) - @build_artifacts = Gitlab.build_artifacts(3, 8) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/builds/8/artifacts")).to have_been_made - end - - it "should return a FileResponse" do - expect(@build_artifacts).to be_a Gitlab::FileResponse - end - - it "should return a file with filename" do - expect(@build_artifacts.filename).to eq "artifacts.zip" - end - end - - context "when bad request" do - it "should throw an exception" do - stub_get("/projects/3/builds/8/artifacts", "error_project_not_found", 404) - 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") - end - end - end - - describe ".builds_commits" do - before do - stub_get("/projects/3/repository/commits/0ff3ae198f8601a285adcf5c0fff204ee6fba5fd/builds", "builds_commits") - @builds_commits = Gitlab.commit_builds(3, "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd") - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/commits/0ff3ae198f8601a285adcf5c0fff204ee6fba5fd/builds")).to have_been_made - end - - it "should return a paginated response of commit builds" do - expect(@builds_commits).to be_a Gitlab::PaginatedResponse - end - - it "should return information about the builds" do - expect(@builds_commits.count).to eq(2) - end - end - - - - describe ".build_cancel" do - before do - stub_post("/projects/3/builds/8/cancel", "build_cancel") - @build_cancel = Gitlab.build_cancel(3, 8) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/builds/8/cancel")).to have_been_made - end - - it "should return a single build" do - expect(@build_cancel).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about a build" do - expect(@build_cancel.commit.author_name).to eq("John Smith") - end - end - - describe ".build_retry" do - before do - stub_post("/projects/3/builds/69/retry", "build_retry") - @build_retry = Gitlab.build_retry(3, 69) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/builds/69/retry")).to have_been_made - end - - it "should return a single build" do - expect(@build_retry).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about a build" do - expect(@build_retry.commit.author_name).to eq("John Smith") - end - end - - describe ".build_erase" do - before do - stub_post("/projects/3/builds/69/erase", "build_erase") - @build_retry = Gitlab.build_erase(3, 69) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/builds/69/erase")).to have_been_made - end - - it "should return a single build" do - expect(@build_retry).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about a build" do - expect(@build_retry.commit.author_name).to eq("John Smith") - end - end -end diff --git a/spec/gitlab/client/client_spec.rb b/spec/gitlab/client/client_spec.rb deleted file mode 100644 index ea0e8ac..0000000 --- a/spec/gitlab/client/client_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe '#inspect' do - it 'masks tokens on inspect' do - client = described_class.new(private_token: 'ui3gIYf4MMzTx-Oh5cEBx') - inspected = client.inspect - expect(inspected).to include('****************cEBx') - end - end -end diff --git a/spec/gitlab/client/commits_spec.rb b/spec/gitlab/client/commits_spec.rb deleted file mode 100644 index 595304a..0000000 --- a/spec/gitlab/client/commits_spec.rb +++ /dev/null @@ -1,168 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - it { should respond_to :repo_commits } - it { should respond_to :repo_commit } - it { should respond_to :repo_commit_diff } - it { should respond_to :repo_commit_comments } - it { should respond_to :repo_create_commit_comment } - it { should respond_to :repo_commit_status } - it { should respond_to :repo_update_commit_status } - - describe ".commits" do - before do - stub_get("/projects/3/repository/commits", "project_commits"). - with(query: { ref_name: "api" }) - @commits = Gitlab.commits(3, ref_name: "api") - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/commits"). - with(query: { ref_name: "api" })).to have_been_made - end - - it "should return a paginated response of repository commits" do - expect(@commits).to be_a Gitlab::PaginatedResponse - expect(@commits.first.id).to eq("f7dd067490fe57505f7226c3b54d3127d2f7fd46") - end - end - - describe ".commit" do - before do - stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6", "project_commit") - @commit = Gitlab.commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6")). - to have_been_made - end - - it "should return a repository commit" do - expect(@commit.id).to eq("6104942438c14ec7bd21c6cd5bd995272b3faff6") - end - end - - describe ".commit_diff" do - before do - stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff", "project_commit_diff") - @diff = Gitlab.commit_diff(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff")). - to have_been_made - end - - it "should return a diff of a commit" do - expect(@diff.new_path).to eq("doc/update/5.4-to-6.0.md") - end - end - - describe ".commit_comments" do - before do - stub_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments", "project_commit_comments") - @commit_comments = Gitlab.commit_comments(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments")). - to have_been_made - end - - it "should return commit's comments" do - expect(@commit_comments).to be_a Gitlab::PaginatedResponse - expect(@commit_comments.length).to eq(2) - expect(@commit_comments[0].note).to eq("this is the 1st comment on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6") - expect(@commit_comments[0].author.id).to eq(11) - expect(@commit_comments[1].note).to eq("another discussion point on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6") - expect(@commit_comments[1].author.id).to eq(12) - end - end - - describe ".create_commit_comment" do - before do - stub_post("/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments", "project_commit_comment") - @merge_request = Gitlab.create_commit_comment(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'Nice code!') - end - - it "should return information about the newly created comment" do - expect(@merge_request.note).to eq('Nice code!') - expect(@merge_request.author.id).to eq(1) - end - end - - describe ".commit_status" do - before do - stub_get("/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses", 'project_commit_status'). - with(query: { all: 'true' }) - @statuses = Gitlab.commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', all: true) - end - - it "should get the correct resource" do - expect(a_get("/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses"). - with(query: { all: true })) - end - - it "should get statuses of a commit" do - expect(@statuses).to be_kind_of Gitlab::PaginatedResponse - expect(@statuses.first.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8') - expect(@statuses.first.ref).to eq('decreased-spec') - expect(@statuses.first.status).to eq('failed') - expect(@statuses.last.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8') - expect(@statuses.last.status).to eq('success') - end - end - - describe ".update_commit_status" do - before do - stub_post("/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8", 'project_update_commit_status'). - with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' }) - @status = Gitlab.update_commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', 'failed', name: 'test', ref: 'decreased-spec') - end - - it "should get the correct resource" do - expect(a_post('/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8'). - with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' })) - end - - it "should information about the newly created status" do - expect(@status).to be_kind_of Gitlab::ObjectifiedHash - expect(@status.id).to eq(498) - expect(@status.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8') - expect(@status.status).to eq('failed') - expect(@status.ref).to eq('decreased-spec') - end - end - - describe ".create_commit" do - let(:actions) do - [ - { - action: "create", - file_path: "foo/bar", - content: "some content" - } - ] - end - - let(:query) do - { - branch: 'dev', - commit_message: 'refactors everything', - actions: actions, - author_email: 'joe@sample.org', - author_name: 'Joe Sample' - } - end - - before do - stub_post("/projects/6/repository/commits", 'project_commit_create').with(body: query) - @commit = Gitlab.create_commit(6, 'dev', 'refactors everything', actions, {author_email: 'joe@sample.org', author_name: 'Joe Sample'}) - end - - it "should return id of a created commit" do - expect(@commit.id).to eq('ed899a2f4b50b4370feeea94676502b42383c746') - end - end -end diff --git a/spec/gitlab/client/environments_spec.rb b/spec/gitlab/client/environments_spec.rb deleted file mode 100644 index 3e10b96..0000000 --- a/spec/gitlab/client/environments_spec.rb +++ /dev/null @@ -1,132 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".environments" do - before do - stub_get("/projects/3/environments", "environments") - @environments = Gitlab.environments(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/environments")).to have_been_made - end - - it "should return a paginated response of project's environments" do - expect(@environments).to be_a Gitlab::PaginatedResponse - end - end - - describe ".environment" do - before do - stub_get("/projects/3/environments/12", "environment") - @environment = Gitlab.environment(3, 12) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/environments/12")).to have_been_made - end - - it "should return a single environment" do - expect(@environment).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about an environment" do - expect(@environment.id).to eq(12) - expect(@environment.name).to eq("staging") - end - end - - describe ".create_environment" do - context "without external_url" do - before do - stub_post("/projects/3/environments", "environment") - @environment = Gitlab.create_environment(3, 'staging') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/environments").with(body: { name: 'staging' })).to have_been_made - end - - it "should return a single environment" do - expect(@environment).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about an environment" do - expect(@environment.name).to eq("staging") - end - end - - context "with external_url" do - before do - stub_post("/projects/3/environments", "environment") - @environment = Gitlab.create_environment(3, 'staging', external_url: "https://staging.example.gitlab.com") - end - - it "should get the correct resource" do - expect(a_post("/projects/3/environments") - .with(body: { name: 'staging', external_url: "https://staging.example.gitlab.com" })).to have_been_made - end - end - end - - describe ".edit_environment" do - before do - stub_put("/projects/3/environments/12", "environment") - @environment = Gitlab.edit_environment(3, 12, { - name: 'staging', - external_url: "https://staging.example.gitlab.com" - }) - end - - it "should get the correct resource" do - expect(a_put("/projects/3/environments/12") - .with(body: { name: 'staging', external_url: "https://staging.example.gitlab.com" })).to have_been_made - end - - it "should return a single environment" do - expect(@environment).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about an environment" do - expect(@environment.name).to eq("staging") - end - end - - describe ".delete_environment" do - before do - stub_delete("/projects/3/environments/12", "environment") - @environment = Gitlab.delete_environment(3, 12) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/environments/12")).to have_been_made - end - - it "should return a single pipeline" do - expect(@environment).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about a pipeline" do - expect(@environment.name).to eq("staging") - end - end - - describe ".stop_environment" do - before do - stub_post("/projects/3/environments/12/stop", "environment") - @environment = Gitlab.stop_environment(3, 12) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/environments/12/stop")).to have_been_made - end - - it "should return a single pipeline" do - expect(@environment).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about a pipeline" do - expect(@environment.name).to eq("staging") - end - end -end diff --git a/spec/gitlab/client/groups_spec.rb b/spec/gitlab/client/groups_spec.rb deleted file mode 100644 index 4ae039c..0000000 --- a/spec/gitlab/client/groups_spec.rb +++ /dev/null @@ -1,195 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".groups" do - before do - stub_get("/groups", "groups") - stub_get("/groups/3", "group") - @group = Gitlab.group(3) - @groups = Gitlab.groups - end - - it "should get the correct resource" do - expect(a_get("/groups")).to have_been_made - expect(a_get("/groups/3")).to have_been_made - end - - it "should return a paginated response of groups" do - expect(@groups).to be_a Gitlab::PaginatedResponse - expect(@groups.first.path).to eq("threegroup") - end - end - - describe ".create_group" do - context "without description" do - before do - stub_post("/groups", "group_create") - @group = Gitlab.create_group('GitLab-Group', 'gitlab-path') - end - - it "should get the correct resource" do - expect(a_post("/groups"). - with(body: { path: 'gitlab-path', name: 'GitLab-Group' })).to have_been_made - end - - it "should return information about a created group" do - expect(@group.name).to eq("Gitlab-Group") - expect(@group.path).to eq("gitlab-group") - end - end - - context "with description" do - before do - stub_post("/groups", "group_create_with_description") - @group = Gitlab.create_group('GitLab-Group', 'gitlab-path', description: 'gitlab group description') - end - - it "should get the correct resource" do - expect(a_post("/groups"). - with(body: { path: 'gitlab-path', name: 'GitLab-Group', - description: 'gitlab group description' })).to have_been_made - end - - it "should return information about a created group" do - expect(@group.name).to eq("Gitlab-Group") - expect(@group.path).to eq("gitlab-group") - expect(@group.description).to eq("gitlab group description") - end - end - end - - describe ".delete_group" do - before do - stub_delete("/groups/42", "group_delete") - @group = Gitlab.delete_group(42) - end - - it "should get the correct resource" do - expect(a_delete("/groups/42")).to have_been_made - end - - it "should return information about a deleted group" do - expect(@group.name).to eq("Gitlab-Group") - expect(@group.path).to eq("gitlab-group") - end - end - - describe ".transfer_project_to_group" do - before do - stub_post("/projects", "project") - @project = Gitlab.create_project('Gitlab') - stub_post("/groups", "group_create") - @group = Gitlab.create_group('GitLab-Group', 'gitlab-path') - - stub_post("/groups/#{@group.id}/projects/#{@project.id}", "group_create") - @group_transfer = Gitlab.transfer_project_to_group(@group.id, @project.id) - end - - it "should post to the correct resource" do - 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 - end - - it "should return information about the group" do - expect(@group_transfer.name).to eq(@group.name) - expect(@group_transfer.path).to eq(@group.path) - expect(@group_transfer.id).to eq(@group.id) - end - end - - describe ".group_members" do - before do - stub_get("/groups/3/members", "group_members") - @members = Gitlab.group_members(3) - end - - it "should get the correct resource" do - expect(a_get("/groups/3/members")).to have_been_made - end - - it "should return information about a group members" do - expect(@members).to be_a Gitlab::PaginatedResponse - expect(@members.size).to eq(2) - expect(@members[1].name).to eq("John Smith") - end - end - - describe ".add_group_member" do - before do - stub_post("/groups/3/members", "group_member") - @member = Gitlab.add_group_member(3, 1, 40) - end - - it "should get the correct resource" do - expect(a_post("/groups/3/members"). - with(body: { user_id: '1', access_level: '40' })).to have_been_made - end - - it "should return information about the added member" do - expect(@member.name).to eq("John Smith") - end - end - - describe ".edit_group_member" do - before do - stub_put("/groups/3/members/1", "group_member_edit") - @member = Gitlab.edit_group_member(3, 1, 50) - end - - it "should get the correct resource" do - expect(a_put("/groups/3/members/1") - .with(body: { access_level: '50'})).to have_been_made - end - - it "should return information about the edited member" do - expect(@member.access_level).to eq(50) - end - end - - describe ".remove_group_member" do - before do - stub_delete("/groups/3/members/1", "group_member_delete") - @group = Gitlab.remove_group_member(3, 1) - end - - it "should get the correct resource" do - expect(a_delete("/groups/3/members/1")).to have_been_made - end - - it "should return information about the group the member was removed from" do - expect(@group.group_id).to eq(3) - end - end - - describe ".group_projects" do - before do - stub_get("/groups/4/projects", "group_projects") - @projects = Gitlab.group_projects(4) - end - - it "should get the list of projects" do - expect(a_get("/groups/4/projects")).to have_been_made - end - - it "should return a list of of projects under a group" do - expect(@projects).to be_a Gitlab::PaginatedResponse - expect(@projects.size).to eq(1) - expect(@projects[0].name).to eq("Diaspora Client") - end - end - - describe ".group_search" do - before do - stub_get("/groups?search=Group", "group_search") - @groups = Gitlab.group_search('Group') - end - - it "should get the correct resource" do - expect(a_get("/groups?search=Group")).to have_been_made - end - - it "should return an array of groups found" do - expect(@groups.first.id).to eq(5) - expect(@groups.last.id).to eq(8) - end - end -end diff --git a/spec/gitlab/client/issues_spec.rb b/spec/gitlab/client/issues_spec.rb deleted file mode 100644 index 543cb2a..0000000 --- a/spec/gitlab/client/issues_spec.rb +++ /dev/null @@ -1,186 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".issues" do - context "with project ID passed" do - before do - stub_get("/projects/3/issues", "project_issues") - @issues = Gitlab.issues(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/issues")).to have_been_made - end - - it "should return a paginated response of project's issues" do - expect(@issues).to be_a Gitlab::PaginatedResponse - expect(@issues.first.project_id).to eq(3) - end - end - - context 'with literal project ID passed' do - before do - stub_get("/projects/gitlab-org%2Fgitlab-ce/issues", "project_issues") - @issues = Gitlab.issues('gitlab-org/gitlab-ce') - end - - it "should get the correct resource" do - expect(a_get("/projects/gitlab-org%2Fgitlab-ce/issues")).to have_been_made - end - - it "should return a paginated response of project's issues" do - expect(@issues).to be_a Gitlab::PaginatedResponse - expect(@issues.first.project_id).to eq(3) - end - end - - context "without project ID passed" do - before do - stub_get("/issues", "issues") - @issues = Gitlab.issues - end - - it "should get the correct resource" do - expect(a_get("/issues")).to have_been_made - end - - it "should return a paginated response of user's issues" do - expect(@issues).to be_a Gitlab::PaginatedResponse - expect(@issues.first.closed).to be_falsey - expect(@issues.first.author.name).to eq("John Smith") - end - end - end - - describe ".issue" do - before do - stub_get("/projects/3/issues/33", "issue") - @issue = Gitlab.issue(3, 33) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/issues/33")).to have_been_made - end - - it "should return information about an issue" do - expect(@issue.project_id).to eq(3) - expect(@issue.assignee.name).to eq("Jack Smith") - end - end - - describe ".create_issue" do - before do - stub_post("/projects/3/issues", "issue") - @issue = Gitlab.create_issue(3, 'title') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/issues"). - with(body: { title: 'title' })).to have_been_made - end - - it "should return information about a created issue" do - expect(@issue.project_id).to eq(3) - expect(@issue.assignee.name).to eq("Jack Smith") - end - end - - describe ".edit_issue" do - before do - stub_put("/projects/3/issues/33", "issue") - @issue = Gitlab.edit_issue(3, 33, title: 'title') - end - - it "should get the correct resource" do - expect(a_put("/projects/3/issues/33"). - with(body: { title: 'title' })).to have_been_made - end - - it "should return information about an edited issue" do - expect(@issue.project_id).to eq(3) - expect(@issue.assignee.name).to eq("Jack Smith") - end - end - - describe ".close_issue" do - before do - stub_put("/projects/3/issues/33", "issue") - @issue = Gitlab.close_issue(3, 33) - end - - it "should get the correct resource" do - expect(a_put("/projects/3/issues/33"). - with(body: { state_event: 'close' })).to have_been_made - end - - it "should return information about an closed issue" do - expect(@issue.project_id).to eq(3) - expect(@issue.assignee.name).to eq("Jack Smith") - end - end - - describe ".reopen_issue" do - before do - stub_put("/projects/3/issues/33", "issue") - @issue = Gitlab.reopen_issue(3, 33) - end - - it "should get the correct resource" do - expect(a_put("/projects/3/issues/33"). - with(body: { state_event: 'reopen' })).to have_been_made - end - - it "should return information about an reopened issue" do - expect(@issue.project_id).to eq(3) - expect(@issue.assignee.name).to eq("Jack Smith") - end - end - - describe ".subscribe_to_issue" do - before do - stub_post("/projects/3/issues/33/subscribe", "issue") - @issue = Gitlab.subscribe_to_issue(3, 33) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/issues/33/subscribe")).to have_been_made - end - - it "should return information about the subscribed issue" do - expect(@issue.project_id).to eq(3) - expect(@issue.assignee.name).to eq("Jack Smith") - end - end - - describe ".unsubscribe_from_issue" do - before do - stub_post("/projects/3/issues/33/unsubscribe", "issue") - @issue = Gitlab.unsubscribe_from_issue(3, 33) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/issues/33/unsubscribe")).to have_been_made - end - - it "should return information about the unsubscribed issue" do - expect(@issue.project_id).to eq(3) - expect(@issue.assignee.name).to eq("Jack Smith") - end - end - - describe ".delete_issue" do - before do - stub_delete("/projects/3/issues/33", "issue") - @issue = Gitlab.delete_issue(3, 33) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/issues/33")).to have_been_made - end - - it "should return information about a deleted issue" do - expect(@issue.project_id).to eq(3) - expect(@issue.id).to eq(33) - end - end -end diff --git a/spec/gitlab/client/jobs_spec.rb b/spec/gitlab/client/jobs_spec.rb deleted file mode 100644 index fcfff79..0000000 --- a/spec/gitlab/client/jobs_spec.rb +++ /dev/null @@ -1,135 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe '.jobs' do - before do - stub_get('/projects/1/jobs', 'jobs') - @projects = Gitlab.jobs(1) - end - - it 'should get the correct resource' do - expect(a_get('/projects/1/jobs')).to have_been_made - end - end - - describe '.jobs - with scopes' do - before do - stub_get('/projects/1/jobs?scope[]=created&scope[]=running', 'jobs') - @projects = Gitlab.jobs(1, scope: %w[created running]) - end - - it 'should get the correct resource' do - expect(a_get('/projects/1/jobs?scope[]=created&scope[]=running')).to have_been_made - end - end - - describe '.pipeline_jobs' do - before do - stub_get('/projects/1/pipelines/1/jobs', 'pipeline_jobs') - @projects = Gitlab.pipeline_jobs(1, 1) - end - it 'should get the correct resource' do - expect(a_get('/projects/1/pipelines/1/jobs')).to have_been_made - end - end - - describe '.pipeline_jobs - with scope' do - before do - stub_get('/projects/1/pipelines/1/jobs?scope[]=running&scope[]=created', 'pipeline_jobs') - @projects = Gitlab.pipeline_jobs(1, 1, scope: %w[running created]) - end - it 'should get the correct resource' do - expect(a_get('/projects/1/pipelines/1/jobs?scope[]=running&scope[]=created')).to have_been_made - end - end - - describe '.job' do - before do - stub_get('/projects/1/jobs/1', 'job') - @projects = Gitlab.job(1, 1) - end - it 'should get the correct resource' do - expect(a_get('/projects/1/jobs/1')).to have_been_made - end - end - - describe '.job_artifacts' do - before do - stub_get('/projects/1/jobs/1/artifacts', 'job') - @projects = Gitlab.job_artifacts(1, 1) - end - it 'should get the correct resource' do - expect(a_get('/projects/1/jobs/1/artifacts')).to have_been_made - end - end - - describe '.job_artifacts_download' do - before do - stub_get('/projects/1/jobs/artifacts/master/download?job=Release%20Build', 'job') - @projects = Gitlab.job_artifacts_download(1, 'master', 'Release Build') - end - it 'should get the correct resource' do - expect(a_get('/projects/1/jobs/artifacts/master/download?job=Release%20Build')).to have_been_made - end - end - - describe '.job_trace' do - before do - stub_get('/projects/1/jobs/1/trace', 'job_trace') - @projects = Gitlab.job_trace(1, 1) - end - it 'should get the correct resource' do - expect(a_get('/projects/1/jobs/1/trace')).to have_been_made - end - end - - describe '.job_cancel' do - before do - stub_post('/projects/1/jobs/1/cancel', 'job') - @projects = Gitlab.job_cancel(1, 1) - end - it 'should get the correct resource' do - expect(a_post('/projects/1/jobs/1/cancel')).to have_been_made - end - end - - describe '.job_retry' do - before do - stub_post('/projects/1/jobs/1/retry', 'job') - @projects = Gitlab.job_retry(1, 1) - end - it 'should get the correct resource' do - expect(a_post('/projects/1/jobs/1/retry')).to have_been_made - end - end - - describe '.job_erase' do - before do - stub_post('/projects/1/jobs/1/erase', 'job') - @projects = Gitlab.job_erase(1, 1) - end - it 'should get the correct resource' do - expect(a_post('/projects/1/jobs/1/erase')).to have_been_made - end - end - - describe '.job_play' do - before do - stub_post('/projects/1/jobs/1/play', 'job') - @projects = Gitlab.job_play(1, 1) - end - it 'should get the correct resource' do - expect(a_post('/projects/1/jobs/1/play')).to have_been_made - end - end - - describe '.job_artifacts_keep' do - before do - stub_post('/projects/1/jobs/1/artifacts/keep', 'job') - @projects = Gitlab.job_artifacts_keep(1, 1) - end - it 'should get the correct resource' do - expect(a_post('/projects/1/jobs/1/artifacts/keep')).to have_been_made - end - end -end diff --git a/spec/gitlab/client/keys_spec.rb b/spec/gitlab/client/keys_spec.rb deleted file mode 100644 index f46c1f3..0000000 --- a/spec/gitlab/client/keys_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".key" do - before do - stub_get("/keys/1", "key") - @key = Gitlab.key(1) - end - - it "should get the correct resource" do - expect(a_get("/keys/1")).to have_been_made - end - - it "should return information about a key" do - expect(@key.id).to eq(1) - expect(@key.title).to eq("narkoz@helium") - end - end -end diff --git a/spec/gitlab/client/labels_spec.rb b/spec/gitlab/client/labels_spec.rb deleted file mode 100644 index 42ec4ec..0000000 --- a/spec/gitlab/client/labels_spec.rb +++ /dev/null @@ -1,100 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".labels" do - before do - stub_get("/projects/3/labels", "labels") - @labels = Gitlab.labels(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/labels")).to have_been_made - end - - it "should return a paginated response of project's labels" do - expect(@labels).to be_a Gitlab::PaginatedResponse - expect(@labels.first.name).to eq("Backlog") - end - end - - describe ".delete" do - before do - stub_delete("/projects/3/labels", "label") - @label = Gitlab.delete_label(3, "Backlog") - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/labels"). - with(body: { name: 'Backlog' })).to have_been_made - end - - it "should return information about a deleted snippet" do - expect(@label.name).to eq("Backlog") - end - end - - describe ".edit_label" do - before do - stub_put("/projects/3/labels", "label") - @label = Gitlab.edit_label(3, "TODO", new_name: 'Backlog') - end - - it "should get the correct resource" do - expect(a_put("/projects/3/labels"). - with(body: { name: 'TODO', new_name: "Backlog" })).to have_been_made - end - - it "should return information about an edited label" do - expect(@label.name).to eq("Backlog") - end - end - - describe ".create_label" do - before do - stub_post("/projects/3/labels", "label") - @label = Gitlab.create_label(3, 'Backlog', '#DD10AA') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/labels"). - with(body: { name: 'Backlog', color: '#DD10AA' })).to have_been_made - end - - it "should return information about a created label" do - expect(@label.name).to eq('Backlog') - expect(@label.color).to eq('#DD10AA') - end - end - - describe ".subscribe_to_label" do - before do - stub_post("/projects/3/labels/Backlog/subscribe", "label") - @label = Gitlab.subscribe_to_label(3, 'Backlog') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/labels/Backlog/subscribe")).to have_been_made - end - - it "should return information about the label subscribed to" do - expect(@label.name).to eq('Backlog') - expect(@label.subscribed).to eq(true) - end - end - - describe ".unsubscribe_from_label" do - before do - stub_post("/projects/3/labels/Backlog/unsubscribe", "label_unsubscribe") - @label = Gitlab.unsubscribe_from_label(3, 'Backlog') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/labels/Backlog/unsubscribe")).to have_been_made - end - - it "should return information about the label subscribed to" do - expect(@label.name).to eq('Backlog') - expect(@label.subscribed).to eq(false) - end - end -end diff --git a/spec/gitlab/client/merge_requests_spec.rb b/spec/gitlab/client/merge_requests_spec.rb deleted file mode 100644 index a06e91d..0000000 --- a/spec/gitlab/client/merge_requests_spec.rb +++ /dev/null @@ -1,224 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".merge_requests" do - before do - stub_get("/projects/3/merge_requests", "merge_requests") - @merge_requests = Gitlab.merge_requests(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/merge_requests")).to have_been_made - end - - it "should return a paginated response of project's merge requests" do - expect(@merge_requests).to be_a Gitlab::PaginatedResponse - expect(@merge_requests.first.project_id).to eq(3) - end - end - - describe ".merge_request" do - before do - stub_get("/projects/3/merge_requests/1", "merge_request") - @merge_request = Gitlab.merge_request(3, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/merge_requests/1")).to have_been_made - end - - it "should return information about a merge request" do - expect(@merge_request.project_id).to eq(3) - expect(@merge_request.assignee.name).to eq("Jack Smith") - end - end - - describe ".create_merge_request" do - before do - stub_post("/projects/3/merge_requests", "merge_request") - end - - it "should return information about a merge request" do - @merge_request = Gitlab.create_merge_request(3, 'New feature', - source_branch: 'api', - target_branch: 'master' - ) - expect(@merge_request.project_id).to eq(3) - expect(@merge_request.assignee.name).to eq("Jack Smith") - end - end - - describe ".update_merge_request" do - before do - stub_put("/projects/3/merge_requests/2", "merge_request"). - with(body: { - assignee_id: '1', - target_branch: 'master', - title: 'A different new feature' - }) - @merge_request = Gitlab.update_merge_request(3, 2, - assignee_id: '1', - target_branch: 'master', - title: 'A different new feature' - ) - end - - it "should get the correct resource" do - expect(a_put("/projects/3/merge_requests/2"). - with(body: { - assignee_id: '1', - target_branch: 'master', - title: 'A different new feature' - })).to have_been_made - end - - it "should return information about a merge request" do - expect(@merge_request.project_id).to eq(3) - expect(@merge_request.assignee.name).to eq("Jack Smith") - end - end - - describe ".accept_merge_request" do - before do - stub_put("/projects/5/merge_requests/42/merge", "merge_request"). - with(body: { merge_commit_message: 'Nice!' }) - @merge_request = Gitlab.accept_merge_request(5, 42, merge_commit_message: 'Nice!') - end - - it "should get the correct resource" do - expect(a_put("/projects/5/merge_requests/42/merge"). - with(body: { merge_commit_message: 'Nice!' })).to have_been_made - end - - it "should return information about merged merge request" do - expect(@merge_request.project_id).to eq(3) - expect(@merge_request.assignee.name).to eq("Jack Smith") - end - end - - describe ".merge_request_comments" do - before do - stub_get("/projects/3/merge_requests/2/notes", "merge_request_comments") - @merge_request = Gitlab.merge_request_comments(3, 2) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/merge_requests/2/notes")).to have_been_made - end - - it "should return merge request's comments" do - expect(@merge_request).to be_an Gitlab::PaginatedResponse - expect(@merge_request.length).to eq(2) - expect(@merge_request[0].note).to eq("this is the 1st comment on the 2merge merge request") - expect(@merge_request[0].author.id).to eq(11) - expect(@merge_request[1].note).to eq("another discussion point on the 2merge request") - expect(@merge_request[1].author.id).to eq(12) - end - end - - describe ".create_merge_request_comment" do - before do - stub_post("/projects/3/merge_requests/2/notes", "merge_request_comment") - @merge_request = Gitlab.create_merge_request_comment(3, 2, 'Cool Merge Request!') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/merge_requests/2/notes")).to have_been_made - end - - it "should return information about a merge request" do - expect(@merge_request.note).to eq('Cool Merge Request!') - expect(@merge_request.author.id).to eq(1) - end - end - - describe ".merge_request_changes" do - before do - stub_get("/projects/3/merge_requests/2/changes", "merge_request_changes") - @mr_changes = Gitlab.merge_request_changes(3, 2) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/merge_requests/2/changes")).to have_been_made - end - - it "should return the merge request changes" do - expect(@mr_changes.changes).to be_a Array - expect(@mr_changes.changes.first['old_path']).to eq('lib/omniauth/builder.rb') - expect(@mr_changes.id).to eq(2) - expect(@mr_changes.project_id).to eq(3) - expect(@mr_changes.source_branch).to eq('uncovered') - expect(@mr_changes.target_branch).to eq('master') - end - end - - describe ".merge_request_commits" do - before do - stub_get("/projects/3/merge_requests/2/commits", "merge_request_commits") - @mr_commits = Gitlab.merge_request_commits(3, 2) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/merge_requests/2/commits")).to have_been_made - end - - it "should return the merge request commits" do - expect(@mr_commits).to be_a Gitlab::PaginatedResponse - expect(@mr_commits.size).to eq 2 - expect(@mr_commits.first.id).to eq "a2da7552f26d5b46a6a09bb8b7b066e3a102be7d" - expect(@mr_commits.first.short_id).to eq "a2da7552" - expect(@mr_commits.first.title).to eq "piyo" - expect(@mr_commits.first.author_name).to eq "example" - expect(@mr_commits.first.author_email).to eq "example@example.com" - expect(@mr_commits[1].short_id).to eq "3ce50959" - expect(@mr_commits[1].title).to eq "hoge" - end - end - - describe ".merge_request_closes_issues" do - before do - stub_get("/projects/5/merge_requests/1/closes_issues", "merge_request_closes_issues") - @issues = Gitlab.merge_request_closes_issues(5, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/5/merge_requests/1/closes_issues")).to have_been_made - end - - it "should return a paginated response of the issues the merge_request will close" do - expect(@issues).to be_a(Gitlab::PaginatedResponse) - expect(@issues.first.title).to eq("Merge request 1 issue 1") - expect(@issues.size).to eq(2) - end - end - - describe ".subscribe_to_merge_request" do - before do - stub_post("/projects/3/merge_requests/2/subscribe", "merge_request") - @merge_request = Gitlab.subscribe_to_merge_request(3, 2) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/merge_requests/2/subscribe")).to have_been_made - end - - it "should return information about a merge request" do - expect(@merge_request.project_id).to eq(3) - end - end - - describe ".unsubscribe_from_merge_request" do - before do - stub_post("/projects/3/merge_requests/2/unsubscribe", "merge_request") - @merge_request = Gitlab.unsubscribe_from_merge_request(3, 2) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/merge_requests/2/unsubscribe")).to have_been_made - end - - it "should return information about a merge request" do - expect(@merge_request.project_id).to eq(3) - end - end -end diff --git a/spec/gitlab/client/milestones_spec.rb b/spec/gitlab/client/milestones_spec.rb deleted file mode 100644 index fdc78c9..0000000 --- a/spec/gitlab/client/milestones_spec.rb +++ /dev/null @@ -1,98 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".milestones" do - before do - stub_get("/projects/3/milestones", "milestones") - @milestones = Gitlab.milestones(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/milestones")).to have_been_made - end - - it "should return a paginated response of project's milestones" do - expect(@milestones).to be_a Gitlab::PaginatedResponse - expect(@milestones.first.project_id).to eq(3) - end - end - - describe ".milestone" do - before do - stub_get("/projects/3/milestones/1", "milestone") - @milestone = Gitlab.milestone(3, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/milestones/1")).to have_been_made - end - - it "should return information about a milestone" do - expect(@milestone.project_id).to eq(3) - end - end - - describe ".milestone_issues" do - before do - stub_get("/projects/3/milestones/1/issues", "milestone_issues") - @milestone_issues = Gitlab.milestone_issues(3, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/milestones/1/issues")).to have_been_made - end - - it "should return a paginated response of milestone's issues" do - expect(@milestone_issues).to be_a Gitlab::PaginatedResponse - expect(@milestone_issues.first.milestone.id).to eq(1) - end - end - - describe ".milestone_merge_requests" do - before do - stub_get("/projects/3/milestones/1/merge_requests", "milestone_merge_requests") - @milestone_merge_requests = Gitlab.milestone_merge_requests(3, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/milestones/1/merge_requests")).to have_been_made - end - - it "should return a paginated response of milestone's merge_requests" do - expect(@milestone_merge_requests).to be_a Gitlab::PaginatedResponse - expect(@milestone_merge_requests.first.milestone.id).to eq(1) - end - end - - describe ".create_milestone" do - before do - stub_post("/projects/3/milestones", "milestone") - @milestone = Gitlab.create_milestone(3, 'title') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/milestones"). - with(body: { title: 'title' })).to have_been_made - end - - it "should return information about a created milestone" do - expect(@milestone.project_id).to eq(3) - end - end - - describe ".edit_milestone" do - before do - stub_put("/projects/3/milestones/33", "milestone") - @milestone = Gitlab.edit_milestone(3, 33, title: 'title') - end - - it "should get the correct resource" do - expect(a_put("/projects/3/milestones/33"). - with(body: { title: 'title' })).to have_been_made - end - - it "should return information about an edited milestone" do - expect(@milestone.project_id).to eq(3) - end - end -end diff --git a/spec/gitlab/client/namespaces_spec.rb b/spec/gitlab/client/namespaces_spec.rb deleted file mode 100644 index 5b94787..0000000 --- a/spec/gitlab/client/namespaces_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - it { should respond_to :namespaces } - - describe ".namespaces" do - before do - stub_get("/namespaces", "namespaces") - @namespaces = Gitlab.namespaces - end - - it "should get the correct resource" do - expect(a_get("/namespaces")).to have_been_made - end - - it "should return a paginated response of namespaces" do - expect(@namespaces).to be_a Gitlab::PaginatedResponse - expect(@namespaces.first.path).to eq("john") - expect(@namespaces.first.kind).to eq("user") - end - end -end diff --git a/spec/gitlab/client/notes_spec.rb b/spec/gitlab/client/notes_spec.rb deleted file mode 100644 index 0aab9ed..0000000 --- a/spec/gitlab/client/notes_spec.rb +++ /dev/null @@ -1,333 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe "notes" do - context "when wall notes" do - before do - stub_get("/projects/3/notes", "notes") - @notes = Gitlab.notes(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/notes")).to have_been_made - end - - it "should return a paginated response of notes" do - expect(@notes).to be_a Gitlab::PaginatedResponse - expect(@notes.first.author.name).to eq("John Smith") - end - end - - context "when issue notes" do - before do - stub_get("/projects/3/issues/7/notes", "notes") - @notes = Gitlab.issue_notes(3, 7) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/issues/7/notes")).to have_been_made - end - - it "should return a paginated response of notes" do - expect(@notes).to be_a Gitlab::PaginatedResponse - expect(@notes.first.author.name).to eq("John Smith") - end - end - - context "when snippet notes" do - before do - stub_get("/projects/3/snippets/7/notes", "notes") - @notes = Gitlab.snippet_notes(3, 7) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/snippets/7/notes")).to have_been_made - end - - it "should return a paginated response of notes" do - expect(@notes).to be_a Gitlab::PaginatedResponse - expect(@notes.first.author.name).to eq("John Smith") - end - end - - context "when merge_request notes" do - before do - stub_get("/projects/3/merge_requests/7/notes", "notes") - @notes = Gitlab.merge_request_notes(3, 7) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/merge_requests/7/notes")).to have_been_made - end - - it "should return a paginated response of notes" do - expect(@notes).to be_a Gitlab::PaginatedResponse - expect(@notes.first.author.name).to eq("John Smith") - end - end - end - - describe "note" do - context "when wall note" do - before do - stub_get("/projects/3/notes/1201", "note") - @note = Gitlab.note(3, 1201) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/notes/1201")).to have_been_made - end - - it "should return information about a note" do - expect(@note.body).to eq("The solution is rather tricky") - expect(@note.author.name).to eq("John Smith") - end - end - - context "when issue note" do - before do - stub_get("/projects/3/issues/7/notes/1201", "note") - @note = Gitlab.issue_note(3, 7, 1201) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/issues/7/notes/1201")).to have_been_made - end - - it "should return information about a note" do - expect(@note.body).to eq("The solution is rather tricky") - expect(@note.author.name).to eq("John Smith") - end - end - - context "when snippet note" do - before do - stub_get("/projects/3/snippets/7/notes/1201", "note") - @note = Gitlab.snippet_note(3, 7, 1201) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/snippets/7/notes/1201")).to have_been_made - end - - it "should return information about a note" do - expect(@note.body).to eq("The solution is rather tricky") - expect(@note.author.name).to eq("John Smith") - end - end - - context "when merge request note" do - before do - stub_get("/projects/3/merge_requests/7/notes/1201", "note") - @note = Gitlab.merge_request_note(3, 7, 1201) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/merge_requests/7/notes/1201")).to have_been_made - end - - it "should return information about a note" do - expect(@note.body).to eq("The solution is rather tricky") - expect(@note.author.name).to eq("John Smith") - end - end - end - - describe "create note" do - context "when wall note" do - before do - stub_post("/projects/3/notes", "note") - @note = Gitlab.create_note(3, "The solution is rather tricky") - end - - it "should get the correct resource" do - expect(a_post("/projects/3/notes"). - with(body: { body: 'The solution is rather tricky' })).to have_been_made - end - - it "should return information about a created note" do - expect(@note.body).to eq("The solution is rather tricky") - expect(@note.author.name).to eq("John Smith") - end - end - - context "when issue note" do - before do - stub_post("/projects/3/issues/7/notes", "note") - @note = Gitlab.create_issue_note(3, 7, "The solution is rather tricky") - end - - it "should get the correct resource" do - expect(a_post("/projects/3/issues/7/notes"). - with(body: { body: 'The solution is rather tricky' })).to have_been_made - end - - it "should return information about a created note" do - expect(@note.body).to eq("The solution is rather tricky") - expect(@note.author.name).to eq("John Smith") - end - end - - context "when snippet note" do - before do - stub_post("/projects/3/snippets/7/notes", "note") - @note = Gitlab.create_snippet_note(3, 7, "The solution is rather tricky") - end - - it "should get the correct resource" do - expect(a_post("/projects/3/snippets/7/notes"). - with(body: { body: 'The solution is rather tricky' })).to have_been_made - end - - it "should return information about a created note" do - expect(@note.body).to eq("The solution is rather tricky") - expect(@note.author.name).to eq("John Smith") - end - end - - context "when merge_request note" do - before do - stub_post("/projects/3/merge_requests/7/notes", "note") - @note = Gitlab.create_merge_request_note(3, 7, "The solution is rather tricky") - end - - it "should get the correct resource" do - expect(a_post("/projects/3/merge_requests/7/notes"). - with(body: { body: 'The solution is rather tricky' })).to have_been_made - end - - it "should return information about a created note" do - expect(@note.body).to eq("The solution is rather tricky") - expect(@note.author.name).to eq("John Smith") - end - end - end - - describe "delete note" do - context "when wall note" do - before do - stub_delete("/projects/3/notes/1201", "note") - @note = Gitlab.delete_note(3, 1201) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/notes/1201")).to have_been_made - end - - it "should return information about a deleted note" do - expect(@note.id).to eq(1201) - end - end - - context "when issue note" do - before do - stub_delete("/projects/3/issues/7/notes/1201", "note") - @note = Gitlab.delete_issue_note(3, 7, 1201) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/issues/7/notes/1201")).to have_been_made - end - - it "should return information about a deleted issue note" do - expect(@note.id).to eq(1201) - end - end - - context "when snippet note" do - before do - stub_delete("/projects/3/snippets/7/notes/1201", "note") - @note = Gitlab.delete_snippet_note(3, 7, 1201) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/snippets/7/notes/1201")).to have_been_made - end - - it "should return information about a deleted snippet note" do - expect(@note.id).to eq(1201) - end - end - - context "when merge request note" do - before do - stub_delete("/projects/3/merge_requests/7/notes/1201", "note") - @note = Gitlab.delete_merge_request_note(3, 7, 1201) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/merge_requests/7/notes/1201")).to have_been_made - end - - it "should return information about a deleted merge request note" do - expect(@note.id).to eq(1201) - end - end - end - - describe "modify note" do - context "when wall note" do - before do - stub_put("/projects/3/notes/1201", "note") - @note = Gitlab.edit_note(3, 1201, body: "edited wall note content") - end - - it "should get the correct resource" do - expect(a_put("/projects/3/notes/1201"). - with(body: {body: 'edited wall note content'})).to have_been_made - end - - it "should return information about a modified note" do - expect(@note.id).to eq(1201) - end - end - - context "when issue note" do - before do - stub_put("/projects/3/issues/7/notes/1201", "note") - @note = Gitlab.edit_issue_note(3, 7, 1201, body: "edited issue note content") - end - - it "should get the correct resource" do - expect(a_put("/projects/3/issues/7/notes/1201"). - with(body: {body: 'edited issue note content'})).to have_been_made - end - - it "should return information about a modified issue note" do - expect(@note.id).to eq(1201) - end - end - - context "when snippet note" do - before do - stub_put("/projects/3/snippets/7/notes/1201", "note") - @note = Gitlab.edit_snippet_note(3, 7, 1201, body: "edited snippet note content") - end - - it "should get the correct resource" do - expect(a_put("/projects/3/snippets/7/notes/1201"). - with(body: {body: 'edited snippet note content'})).to have_been_made - end - - it "should return information about a modified snippet note" do - expect(@note.id).to eq(1201) - end - end - - context "when merge request note" do - before do - stub_put("/projects/3/merge_requests/7/notes/1201", "note") - @note = Gitlab.edit_merge_request_note(3, 7, 1201, body: "edited merge request note content") - end - - it "should get the correct resource" do - expect(a_put("/projects/3/merge_requests/7/notes/1201"). - with(body: {body: 'edited merge request note content'})).to have_been_made - end - - it "should return information about a modified request note" do - expect(@note.id).to eq(1201) - end - end - end -end diff --git a/spec/gitlab/client/pipeline_triggers_spec.rb b/spec/gitlab/client/pipeline_triggers_spec.rb deleted file mode 100644 index ce5fd24..0000000 --- a/spec/gitlab/client/pipeline_triggers_spec.rb +++ /dev/null @@ -1,157 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - it { should respond_to :delete_trigger } - - describe ".triggers" do - before do - stub_get("/projects/3/triggers", "triggers") - @triggers = Gitlab.triggers(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/triggers")).to have_been_made - end - - it "should return an array of project's triggers" do - expect(@triggers).to be_a Gitlab::PaginatedResponse - expect(@triggers.first.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7") - end - end - - describe ".trigger" do - before do - stub_get("/projects/3/triggers/10", "trigger") - @trigger = Gitlab.trigger(3, 10) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/triggers/10")).to have_been_made - end - - it "should return information about a trigger" do - expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z") - expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7") - end - end - - describe ".create_trigger" do - before do - stub_post("/projects/3/triggers", "trigger") - @trigger = Gitlab.create_trigger(3, "my description") - end - - it "should get the correct resource" do - expect(a_post("/projects/3/triggers"). - with(body: { description: "my description" })).to have_been_made - end - - it "should return information about a new trigger" do - expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z") - expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7") - end - end - - describe ".update_trigger" do - before do - stub_put("/projects/3/triggers/1", "trigger") - @trigger = Gitlab.update_trigger(3, 1, description: "my description") - end - - it "should get the correct resource" do - expect(a_put("/projects/3/triggers/1"). - with(body: { description: "my description" })).to have_been_made - end - - it "should return information about the trigger" do - expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z") - expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7") - end - end - - describe ".trigger_take_ownership" do - before do - stub_post("/projects/3/triggers/1/take_ownership", "trigger") - @trigger = Gitlab.trigger_take_ownership(3, 1) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/triggers/1/take_ownership")).to have_been_made - end - - it "should return information about the trigger" do - expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z") - expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7") - end - end - - describe ".remove_trigger" do - before do - stub_delete("/projects/3/triggers/10", "empty") - @trigger = Gitlab.remove_trigger(3, 10) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/triggers/10")).to have_been_made - end - end - - describe ".run_trigger" do - before do - stub_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline"). - to_return(body: load_fixture("run_trigger"), status: 200) - end - - context "when private_token is not set" do - before do - Gitlab.private_token = nil - end - - it "should not raise Error::MissingCredentials" do - expect { Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master", {a: 10}) }.to_not raise_error - end - - after do - Gitlab.private_token = 'secret' - end - end - - context "without variables" do - before do - @trigger = Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master") - end - - it "should get the correct resource" do - expect(a_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline"). - with(body: { - token: "7b9148c158980bbd9bcea92c17522d", - ref: "master" - })).to have_been_made - end - - it "should return information about the triggered build" do - expect(@trigger.id).to eq(8) - end - end - - context "with variables" do - before do - @trigger = Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master", {a: 10}) - end - - it "should get the correct resource" do - expect(a_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline"). - with(body: { - token: "7b9148c158980bbd9bcea92c17522d", - ref: "master", - variables: {a: "10"} - })).to have_been_made - end - - it "should return information about the triggered build" do - expect(@trigger.id).to eq(8) - expect(@trigger.variables.a).to eq("10") - end - end - end -end diff --git a/spec/gitlab/client/pipelines_spec.rb b/spec/gitlab/client/pipelines_spec.rb deleted file mode 100644 index 3e5406a..0000000 --- a/spec/gitlab/client/pipelines_spec.rb +++ /dev/null @@ -1,95 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".pipelines" do - before do - stub_get("/projects/3/pipelines", "pipelines") - @pipelines = Gitlab.pipelines(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/pipelines")).to have_been_made - end - - it "should return a paginated response of project's pipelines" do - expect(@pipelines).to be_a Gitlab::PaginatedResponse - end - end - - describe ".pipeline" do - before do - stub_get("/projects/3/pipelines/46", "pipeline") - @pipeline = Gitlab.pipeline(3, 46) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/pipelines/46")).to have_been_made - end - - it "should return a single pipeline" do - expect(@pipeline).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about a pipeline" do - expect(@pipeline.id).to eq(46) - expect(@pipeline.user.name).to eq("Administrator") - end - end - - describe ".create_pipeline" do - before do - stub_post("/projects/3/pipeline?ref=master", "pipeline_create") - @pipeline_create = Gitlab.create_pipeline(3, 'master') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/pipeline?ref=master")).to have_been_made - end - - it "should return a single pipeline" do - expect(@pipeline_create).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about a pipeline" do - expect(@pipeline_create.user.name).to eq("Administrator") - end - end - - describe ".cancel_pipeline" do - before do - stub_post("/projects/3/pipelines/46/cancel", "pipeline_cancel") - @pipeline_cancel = Gitlab.cancel_pipeline(3, 46) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/pipelines/46/cancel")).to have_been_made - end - - it "should return a single pipeline" do - expect(@pipeline_cancel).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about a pipeline" do - expect(@pipeline_cancel.user.name).to eq("Administrator") - end - end - - describe ".retry_pipeline" do - before do - stub_post("/projects/3/pipelines/46/retry", "pipeline_retry") - @pipeline_retry = Gitlab.retry_pipeline(3, 46) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/pipelines/46/retry")).to have_been_made - end - - it "should return a single pipeline" do - expect(@pipeline_retry).to be_a Gitlab::ObjectifiedHash - end - - it "should return information about a pipeline" do - expect(@pipeline_retry.user.name).to eq("Administrator") - end - end -end diff --git a/spec/gitlab/client/projects_spec.rb b/spec/gitlab/client/projects_spec.rb deleted file mode 100644 index fea9198..0000000 --- a/spec/gitlab/client/projects_spec.rb +++ /dev/null @@ -1,613 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - it { should respond_to :search_projects } - - describe ".projects" do - before do - stub_get("/projects", "projects") - @projects = Gitlab.projects - end - - it "should get the correct resource" do - expect(a_get("/projects")).to have_been_made - end - - it "should return a paginated response of projects" do - expect(@projects).to be_a Gitlab::PaginatedResponse - expect(@projects.first.name).to eq("Brute") - expect(@projects.first.owner.name).to eq("John Smith") - end - end - - describe ".project_search" do - before do - stub_get("/projects?search=Gitlab", "project_search") - @project_search = Gitlab.project_search("Gitlab") - end - - it "should get the correct resource" do - expect(a_get("/projects?search=Gitlab")).to have_been_made - end - - it "should return a paginated response of projects found" do - expect(@project_search).to be_a Gitlab::PaginatedResponse - expect(@project_search.first.name).to eq("Gitlab") - expect(@project_search.first.owner.name).to eq("John Smith") - end - end - - describe ".project" do - before do - stub_get("/projects/3", "project") - @project = Gitlab.project(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3")).to have_been_made - end - - it "should return information about a project" do - expect(@project.name).to eq("Gitlab") - expect(@project.owner.name).to eq("John Smith") - end - end - - describe ".project_events" do - before do - stub_get("/projects/2/events", "project_events") - @events = Gitlab.project_events(2) - end - - it "should get the correct resource" do - expect(a_get("/projects/2/events")).to have_been_made - end - - it "should return a paginated response of events" do - expect(@events).to be_a Gitlab::PaginatedResponse - expect(@events.size).to eq(2) - end - - it "should return the action name of the event" do - expect(@events.first.action_name).to eq("opened") - end - end - - describe ".create_project" do - before do - stub_post("/projects", "project") - @project = Gitlab.create_project('Gitlab') - end - - it "should get the correct resource" do - expect(a_post("/projects")).to have_been_made - end - - it "should return information about a created project" do - expect(@project.name).to eq("Gitlab") - expect(@project.owner.name).to eq("John Smith") - end - end - - describe ".create_project for user" do - before do - stub_post("/users", "user") - @owner = Gitlab.create_user("john@example.com", "pass", name: 'John Owner') - stub_post("/projects/user/#{@owner.id}", "project_for_user") - @project = Gitlab.create_project('Brute', user_id: @owner.id) - end - - it "should return information about a created project" do - expect(@project.name).to eq("Brute") - expect(@project.owner.name).to eq("John Owner") - end - end - - describe ".delete_project" do - before do - stub_delete("/projects/Gitlab", "project") - @project = Gitlab.delete_project('Gitlab') - end - - it "should get the correct resource" do - expect(a_delete("/projects/Gitlab")).to have_been_made - end - - it "should return information about a deleted project" do - expect(@project.name).to eq("Gitlab") - expect(@project.owner.name).to eq("John Smith") - end - end - - describe ".create_fork" do - context "without sudo option" do - before do - stub_post("/projects/3/fork", "project_fork") - @project = Gitlab.create_fork(3) - end - - it "should post to the correct resource" do - expect(a_post("/projects/3/fork")).to have_been_made - end - - it "should return information about the forked project" do - expect(@project.forked_from_project.id).to eq(3) - expect(@project.id).to eq(20) - end - end - - context "with the sudo option" do - before do - stub_post("/projects/3/fork", "project_forked_for_user") - @sudoed_username = 'jack.smith' - @project = Gitlab.create_fork(3, sudo: @sudoed_username) - end - - it "should post to the correct resource" do - expect(a_post("/projects/3/fork")).to have_been_made - end - - it "should return information about the forked project" do - expect(@project.forked_from_project.id).to eq(3) - expect(@project.id).to eq(20) - expect(@project.owner.username).to eq(@sudoed_username) - end - end - end - - describe ".team_members" do - before do - stub_get("/projects/3/members", "team_members") - @team_members = Gitlab.team_members(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/members")).to have_been_made - end - - it "should return a paginated response of team members" do - expect(@team_members).to be_a Gitlab::PaginatedResponse - expect(@team_members.first.name).to eq("John Smith") - end - end - - describe ".team_member" do - before do - stub_get("/projects/3/members/1", "team_member") - @team_member = Gitlab.team_member(3, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/members/1")).to have_been_made - end - - it "should return information about a team member" do - expect(@team_member.name).to eq("John Smith") - end - end - - describe ".add_team_member" do - before do - stub_post("/projects/3/members", "team_member") - @team_member = Gitlab.add_team_member(3, 1, 40) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/members"). - with(body: { user_id: '1', access_level: '40' })).to have_been_made - end - - it "should return information about an added team member" do - expect(@team_member.name).to eq("John Smith") - end - end - - describe ".edit_team_member" do - before do - stub_put("/projects/3/members/1", "team_member") - @team_member = Gitlab.edit_team_member(3, 1, 40) - end - - it "should get the correct resource" do - expect(a_put("/projects/3/members/1"). - with(body: { access_level: '40' })).to have_been_made - end - - it "should return information about an edited team member" do - expect(@team_member.name).to eq("John Smith") - end - end - - describe ".remove_team_member" do - before do - stub_delete("/projects/3/members/1", "team_member") - @team_member = Gitlab.remove_team_member(3, 1) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/members/1")).to have_been_made - end - - it "should return information about a removed team member" do - expect(@team_member.name).to eq("John Smith") - end - end - - describe ".project_hooks" do - before do - stub_get("/projects/1/hooks", "project_hooks") - @hooks = Gitlab.project_hooks(1) - end - - it "should get the correct resource" do - expect(a_get("/projects/1/hooks")).to have_been_made - end - - it "should return a paginated response of hooks" do - expect(@hooks).to be_a Gitlab::PaginatedResponse - expect(@hooks.first.url).to eq("https://api.example.net/v1/webhooks/ci") - end - end - - describe ".project_hook" do - before do - stub_get("/projects/1/hooks/1", "project_hook") - @hook = Gitlab.project_hook(1, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/1/hooks/1")).to have_been_made - end - - it "should return information about a hook" do - expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci") - end - end - - describe ".add_project_hook" do - context "without specified events" do - before do - stub_post("/projects/1/hooks", "project_hook") - @hook = Gitlab.add_project_hook(1, "https://api.example.net/v1/webhooks/ci") - end - - it "should get the correct resource" do - body = { url: "https://api.example.net/v1/webhooks/ci" } - expect(a_post("/projects/1/hooks").with(body: body)).to have_been_made - end - - it "should return information about an added hook" do - expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci") - end - end - - context "with specified events" do - before do - stub_post("/projects/1/hooks", "project_hook") - @hook = Gitlab.add_project_hook(1, "https://api.example.net/v1/webhooks/ci", push_events: true, merge_requests_events: true) - end - - it "should get the correct resource" do - body = { url: "https://api.example.net/v1/webhooks/ci", push_events: "true", merge_requests_events: "true" } - expect(a_post("/projects/1/hooks").with(body: body)).to have_been_made - end - - it "should return information about an added hook" do - expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci") - end - end - end - - describe ".edit_project_hook" do - before do - stub_put("/projects/1/hooks/1", "project_hook") - @hook = Gitlab.edit_project_hook(1, 1, "https://api.example.net/v1/webhooks/ci") - end - - it "should get the correct resource" do - body = { url: "https://api.example.net/v1/webhooks/ci" } - expect(a_put("/projects/1/hooks/1").with(body: body)).to have_been_made - end - - it "should return information about an edited hook" do - expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci") - end - end - - describe ".edit_project" do - context "using project ID" do - before do - stub_put("/projects/3", "project_edit").with(body: { name: "Gitlab-edit" }) - @edited_project = Gitlab.edit_project(3, name: "Gitlab-edit") - end - - it "should get the correct resource" do - expect(a_put("/projects/3").with(body: { name: "Gitlab-edit" })).to have_been_made - end - - it "should return information about an edited project" do - expect(@edited_project.name).to eq("Gitlab-edit") - end - end - - context "using namespaced project path" do - it "encodes the path properly" do - stub = stub_put("/projects/namespace%2Fpath", "project_edit").with(body: { name: "Gitlab-edit" }) - Gitlab.edit_project('namespace/path', name: "Gitlab-edit") - expect(stub).to have_been_requested - end - end - end - - describe ".delete_project_hook" do - context "when empty response" do - before do - stub_request(:delete, "#{Gitlab.endpoint}/projects/1/hooks/1"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }). - to_return(body: '') - @hook = Gitlab.delete_project_hook(1, 1) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/hooks/1")).to have_been_made - end - - it "should return false" do - expect(@hook).to be(false) - end - end - - context "when JSON response" do - before do - stub_delete("/projects/1/hooks/1", "project_hook") - @hook = Gitlab.delete_project_hook(1, 1) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/hooks/1")).to have_been_made - end - - it "should return information about a deleted hook" do - expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci") - end - end - end - - describe ".push_rule" do - before do - stub_get("/projects/1/push_rule", "push_rule") - @push_rule = Gitlab.push_rule(1) - end - - it "should get the correct resource" do - expect(a_get("/projects/1/push_rule")).to have_been_made - end - - it "should return information about a push rule" do - expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b") - end - end - - describe ".add_push_rule" do - before do - stub_post("/projects/1/push_rule", "push_rule") - @push_rule = Gitlab.add_push_rule(1, { deny_delete_tag: false, commit_message_regex: "\\b[A-Z]{3}-[0-9]+\\b" }) - end - - it "should get the correct resource" do - expect(a_post("/projects/1/push_rule")).to have_been_made - end - - it "should return information about an added push rule" do - expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b") - end - end - - describe ".edit_push_rule" do - before do - stub_put("/projects/1/push_rule", "push_rule") - @push_rule = Gitlab.edit_push_rule(1, { deny_delete_tag: false, commit_message_regex: "\\b[A-Z]{3}-[0-9]+\\b" }) - end - - it "should get the correct resource" do - expect(a_put("/projects/1/push_rule")).to have_been_made - end - - it "should return information about an edited push rule" do - expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b") - end - end - - describe ".delete_push_rule" do - context "when empty response" do - before do - stub_request(:delete, "#{Gitlab.endpoint}/projects/1/push_rule"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }). - to_return(body: '') - @push_rule = Gitlab.delete_push_rule(1) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/push_rule")).to have_been_made - end - - it "should return false" do - expect(@push_rule).to be(false) - end - end - - context "when JSON response" do - before do - stub_delete("/projects/1/push_rule", "push_rule") - @push_rule = Gitlab.delete_push_rule(1) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/push_rule")).to have_been_made - end - - it "should return information about a deleted push rule" do - expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b") - end - end - end - - describe ".make_forked_from" do - before do - stub_post("/projects/42/fork/24", "project_fork_link") - @forked_project_link = Gitlab.make_forked_from(42, 24) - end - - it "should get the correct resource" do - expect(a_post("/projects/42/fork/24")).to have_been_made - end - - it "should return information about a forked project" do - expect(@forked_project_link.forked_from_project_id).to eq(24) - expect(@forked_project_link.forked_to_project_id).to eq(42) - end - end - - describe ".remove_forked" do - before do - stub_delete("/projects/42/fork", "project_fork_link") - @forked_project_link = Gitlab.remove_forked(42) - end - - it "should be sent to correct resource" do - expect(a_delete("/projects/42/fork")).to have_been_made - end - - it "should return information about an unforked project" do - expect(@forked_project_link.forked_to_project_id).to eq(42) - end - end - - describe ".deploy_keys" do - before do - stub_get("/projects/42/deploy_keys", "project_keys") - @deploy_keys = Gitlab.deploy_keys(42) - end - - it "should get the correct resource" do - expect(a_get("/projects/42/deploy_keys")).to have_been_made - end - - it "should return project deploy keys" do - expect(@deploy_keys).to be_a Gitlab::PaginatedResponse - expect(@deploy_keys.first.id).to eq 2 - expect(@deploy_keys.first.title).to eq "Key Title" - expect(@deploy_keys.first.key).to match(/ssh-rsa/) - end - end - - describe ".deploy_key" do - before do - stub_get("/projects/42/deploy_keys/2", "project_key") - @deploy_key = Gitlab.deploy_key(42, 2) - end - - it "should get the correct resource" do - expect(a_get("/projects/42/deploy_keys/2")).to have_been_made - end - - it "should return project deploy key" do - expect(@deploy_key.id).to eq 2 - expect(@deploy_key.title).to eq "Key Title" - expect(@deploy_key.key).to match(/ssh-rsa/) - end - end - - describe ".delete_deploy_key" do - before do - stub_delete("/projects/42/deploy_keys/2", "project_key") - @deploy_key = Gitlab.delete_deploy_key(42, 2) - end - - it "should get the correct resource" do - expect(a_delete("/projects/42/deploy_keys/2")).to have_been_made - end - - it "should return information about a deleted key" do - expect(@deploy_key.id).to eq(2) - end - end - - describe ".enable_deploy_key" do - before do - stub_post("/projects/42/deploy_keys/2/enable", "project_key") - @deploy_key = Gitlab.enable_deploy_key(42, 2) - end - - it "should get the correct resource" do - expect(a_post("/projects/42/deploy_keys/2/enable"). - with(body: { id: '42', key_id: '2' })).to have_been_made - end - - it "should return information about an enabled key" do - expect(@deploy_key.id).to eq(2) - end - end - - describe ".disable_deploy_key" do - before do - stub_post("/projects/42/deploy_keys/2/disable", "project_key") - @deploy_key = Gitlab.disable_deploy_key(42, 2) - end - - it "should get the correct resource" do - expect(a_post("/projects/42/deploy_keys/2/disable"). - with(body: { id: '42', key_id: '2' })).to have_been_made - end - - it "should return information about a disabled key" do - expect(@deploy_key.id).to eq(2) - end - end - - describe ".share_project_with_group" do - before do - stub_post("/projects/3/share", "group") - @group = Gitlab.share_project_with_group(3, 10, 40) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/share"). - with(body: { group_id: '10', group_access: '40' })).to have_been_made - end - - it "should return information about an added group" do - expect(@group.id).to eq(10) - end - end - - describe ".star_project" do - before do - stub_post("/projects/3/star", "project_star") - @starred_project = Gitlab.star_project(3) - end - - it "should get the correct resource" do - expect(a_post("/projects/3/star")).to have_been_made - end - - it "should return information about the starred project" do - expect(@starred_project.id).to eq(3) - end - end - - describe ".unstar_project" do - before do - stub_delete("/projects/3/star", "project_unstar") - @unstarred_project = Gitlab.unstar_project(3) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/star")).to have_been_made - end - - it "should return information about the unstarred project" do - expect(@unstarred_project.id).to eq(3) - end - end -end diff --git a/spec/gitlab/client/repositories_spec.rb b/spec/gitlab/client/repositories_spec.rb deleted file mode 100644 index c972d31..0000000 --- a/spec/gitlab/client/repositories_spec.rb +++ /dev/null @@ -1,94 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - it { should respond_to :repo_tags } - it { should respond_to :repo_create_tag } - it { should respond_to :repo_branches } - it { should respond_to :repo_branch } - it { should respond_to :repo_tree } - it { should respond_to :repo_compare } - - describe ".tags" do - before do - stub_get("/projects/3/repository/tags", "project_tags") - @tags = Gitlab.tags(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/tags")).to have_been_made - end - - it "should return a paginated response of repository tags" do - expect(@tags).to be_a Gitlab::PaginatedResponse - expect(@tags.first.name).to eq("v2.8.2") - end - end - - describe ".create_tag" do - context "when lightweight" do - before do - stub_post("/projects/3/repository/tags", "project_tag_lightweight") - @tag = Gitlab.create_tag(3, 'v1.0.0', '2695effb5807a22ff3d138d593fd856244e155e7') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/repository/tags")).to have_been_made - end - - it "should return information about a new repository tag" do - expect(@tag.name).to eq("v1.0.0") - expect(@tag.message).to eq(nil) - end - end - - context "when annotated" do - before do - stub_post("/projects/3/repository/tags", "project_tag_annotated") - @tag = Gitlab.create_tag(3, 'v1.1.0', '2695effb5807a22ff3d138d593fd856244e155e7', 'Release 1.1.0') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/repository/tags")).to have_been_made - end - - it "should return information about a new repository tag" do - expect(@tag.name).to eq("v1.1.0") - expect(@tag.message).to eq("Release 1.1.0") - end - end - end - - describe ".tree" do - before do - stub_get("/projects/3/repository/tree", "tree") - @tree = Gitlab.tree(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/tree")).to have_been_made - end - - it "should return a paginated response of repository tree files (root level)" do - expect(@tree).to be_a Gitlab::PaginatedResponse - expect(@tree.first.name).to eq("app") - end - end - - describe ".compare" do - before do - stub_get("/projects/3/repository/compare", "compare_merge_request_diff"). - with(query: { from: "master", to: "feature" }) - @diff = Gitlab.compare(3, 'master', 'feature') - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/compare"). - with(query: { from: "master", to: "feature" })).to have_been_made - end - - it "should get diffs of a merge request" do - expect(@diff.diffs).to be_kind_of Array - expect(@diff.diffs.last["new_path"]).to eq "files/js/application.js" - end - end -end diff --git a/spec/gitlab/client/repository_files_spec.rb b/spec/gitlab/client/repository_files_spec.rb deleted file mode 100644 index 1b89313..0000000 --- a/spec/gitlab/client/repository_files_spec.rb +++ /dev/null @@ -1,95 +0,0 @@ -require "spec_helper" - -describe Gitlab::Client do - describe ".file_contents" do - before do - stub_get("/projects/3/repository/files/Gemfile/raw?ref=master", "raw_file") - @file_contents = Gitlab.file_contents(3, "Gemfile") - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/files/Gemfile/raw?ref=master")).to have_been_made - end - - it "should return file contents" do - expect(@file_contents).to eq("source 'https://rubygems.org'\ngem 'rails', '4.1.2'\n") - end - end - - describe ".get_file" do - before do - stub_get("/projects/3/repository/files/README%2Emd?ref=master", "get_repository_file") - @file = Gitlab.get_file(3, 'README.md', 'master') - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/files/README%2Emd?ref=master")).to have_been_made - end - - it "should return the base64 encoded file" do - expect(@file.file_path).to eq "README.md" - expect(@file.ref).to eq "master" - expect(@file.content).to eq "VGhpcyBpcyBhICpSRUFETUUqIQ==\n" - end - end - - describe ".create_file" do - let(:api_path) { "/projects/3/repository/files/path" } - let!(:request_stub) { stub_post(api_path, "repository_file") } - let!(:file) { Gitlab.create_file(3, "path", "branch", "content", "commit message", author_name: "joe") } - - it "should create the correct resource" do - expected_parameters = { - author_name: "joe", - branch: "branch", - commit_message: "commit message" - } - expect(a_post(api_path).with(body: hash_including(expected_parameters))).to have_been_made - end - - it "should return information about the new file" do - expect(file.file_path).to eq "path" - expect(file.branch_name).to eq "branch" - end - end - - describe ".edit_file" do - let(:api_path) { "/projects/3/repository/files/path" } - let!(:request_stub) { stub_put(api_path, "repository_file") } - let!(:file) { Gitlab.edit_file(3, "path", "branch", "content", "commit message", author_name: "joe") } - - it "should update the correct resource" do - expected_parameters = { - author_name: "joe", - branch: "branch", - commit_message: "commit message" - } - expect(a_put(api_path).with(body: hash_including(expected_parameters))).to have_been_made - end - - it "should return information about the new file" do - expect(file.file_path).to eq "path" - expect(file.branch_name).to eq "branch" - end - end - - describe ".remove_file" do - let(:api_path) { "/projects/3/repository/files/path" } - let!(:request_stub) { stub_delete(api_path, "repository_file") } - let!(:file) { Gitlab.remove_file(3, "path", "branch", "commit message", author_name: "joe") } - - it "should update the correct resource" do - expected_parameters = { - author_name: "joe", - branch: "branch", - commit_message: "commit message" - } - expect(a_delete(api_path).with(body: hash_including(expected_parameters))).to have_been_made - end - - it "should return information about the new file" do - expect(file.file_path).to eq "path" - expect(file.branch_name).to eq "branch" - end - end -end diff --git a/spec/gitlab/client/runners_spec.rb b/spec/gitlab/client/runners_spec.rb deleted file mode 100644 index 0eb43b8..0000000 --- a/spec/gitlab/client/runners_spec.rb +++ /dev/null @@ -1,185 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - - describe ".runners" do - before do - stub_get("/runners", "runners") - end - - context 'without scope' do - before do - @runner = Gitlab.runners - end - - it "should get the correct resource" do - expect(a_get("/runners")).to have_been_made - end - - it "should return a paginated response of runners" do - expect(@runner).to be_a Gitlab::PaginatedResponse - expect(@runner.first.id).to eq(6) - expect(@runner.first.description).to eq('test-1-20150125') - end - end - - context 'with scope' do - before do - stub_get("/runners?scope=online", "runners") - @runner = Gitlab.runners({scope: :online}) - end - - it "should get the correct resource" do - expect(a_get("/runners").with(query: { scope: :online })).to have_been_made - end - - it "should return a paginated response of runners" do - expect(@runner).to be_a Gitlab::PaginatedResponse - expect(@runner.first.id).to eq(6) - expect(@runner.first.description).to eq('test-1-20150125') - end - end - - end - - describe ".all_runners" do - before do - stub_get("/runners/all", "runners") - end - - context 'without scope' do - before do - @runner = Gitlab.all_runners - end - - it "should get the correct resource" do - expect(a_get("/runners/all")).to have_been_made - end - - it "should return a paginated response of runners" do - expect(@runner).to be_a Gitlab::PaginatedResponse - expect(@runner.first.id).to eq(6) - expect(@runner.first.description).to eq('test-1-20150125') - end - end - - context 'with scope' do - before do - stub_get("/runners/all?scope=online", "runners") - @runner = Gitlab.all_runners({scope: :online}) - end - - it "should get the correct resource" do - expect(a_get("/runners/all").with(query: { scope: :online })).to have_been_made - end - - it "should return a paginated response of runners" do - expect(@runner).to be_a Gitlab::PaginatedResponse - expect(@runner.first.id).to eq(6) - expect(@runner.first.description).to eq('test-1-20150125') - end - end - end - - describe ".runner" do - before do - stub_get("/runners/6", "runner") - @runners = Gitlab.runner(6) - end - - it "should get the correct resource" do - expect(a_get("/runners/6")).to have_been_made - end - - it "should return a response of a runner" do - expect(@runners).to be_a Gitlab::ObjectifiedHash - expect(@runners.id).to eq(6) - expect(@runners.description).to eq('test-1-20150125') - end - end - - describe ".update_runner" do - before do - stub_put("/runners/6", "runner_edit").with(query: { description: "abcefg" }) - @runner = Gitlab.update_runner(6, description: "abcefg" ) - end - - it "should get the correct resource" do - expect(a_put("/runners/6").with(query: { description: "abcefg" })).to have_been_made - end - - it "should return an updated response of a runner" do - expect(@runner).to be_a Gitlab::ObjectifiedHash - expect(@runner.description).to eq('abcefg') - end - end - - describe ".delete_runner" do - before do - stub_delete("/runners/6", "runner_delete") - @runner = Gitlab.delete_runner(6) - end - - it "should get the correct resource" do - expect(a_delete("/runners/6")).to have_been_made - end - - it "should return a response of the deleted runner" do - expect(@runner).to be_a Gitlab::ObjectifiedHash - expect(@runner.id).to eq(6) - end - end - - describe ".project_runners" do - before do - stub_get("/projects/1/runners", "project_runners") - @runners = Gitlab.project_runners(1) - end - - it "should get the correct resource" do - expect(a_get("/projects/1/runners")).to have_been_made - end - - it "should return a paginated response of runners" do - expect(@runners).to be_a Gitlab::PaginatedResponse - expect(@runners.first.id).to eq(8) - expect(@runners.first.description).to eq('test-2-20150125') - end - end - - describe ".project_enable_runner" do - before do - stub_post("/projects/1/runners", "runner") - @runner = Gitlab.project_enable_runner(1, 6) - end - - it "should get the correct resource" do - expect(a_post("/projects/1/runners")).to have_been_made - end - - it "should return a response of the enabled runner" do - expect(@runner).to be_a Gitlab::ObjectifiedHash - expect(@runner.id).to eq(6) - expect(@runner.description).to eq('test-1-20150125') - end - end - - describe ".project_disable_runner" do - before do - stub_delete("/projects/1/runners/6", "runner") - @runner = Gitlab.project_disable_runner(1, 6) - end - - it "should get the correct resource" do - expect(a_delete("/projects/1/runners/6")).to have_been_made - end - - it "should return a response of the disabled runner" do - expect(@runner).to be_a Gitlab::ObjectifiedHash - expect(@runner.id).to eq(6) - expect(@runner.description).to eq('test-1-20150125') - end - end - - -end diff --git a/spec/gitlab/client/services_spec.rb b/spec/gitlab/client/services_spec.rb deleted file mode 100644 index 7a093bb..0000000 --- a/spec/gitlab/client/services_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".service" do - before do - stub_get("/projects/3/services/redmine", "service") - @service = Gitlab.service(3, :redmine) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/services/redmine")).to have_been_made - end - - it "should return a information about a service of project" do - expect(@service.id).to eq 38 - expect(@service.title).to eq("Redmine") - expect(@service.properties.project_url).to eq("https://example.com/projects/test_project/issue") - end - end - - describe ".change_service" do - before do - stub_put("/projects/3/services/redmine", "service") - @service = Gitlab.change_service(3, :redmine, new_issue_url: 'https://example.com/projects/test_project/issues/new', - project_url: 'https://example.com/projects/test_project/issues', - issues_url: 'https://example.com/issues/:id') - end - - it "should get the correct resource" do - body = {new_issue_url: 'https://example.com/projects/test_project/issues/new', - project_url: 'https://example.com/projects/test_project/issues', - issues_url: 'https://example.com/issues/:id'} - expect(a_put("/projects/3/services/redmine").with(body: body)).to have_been_made - end - - it "should return information about a new service" do - expect(@service).to be_truthy - end - end - - describe ".delete_servoce" do - before do - stub_delete("/projects/3/services/redmine", "service") - @service = Gitlab.delete_service(3, :redmine) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/services/redmine")).to have_been_made - end - - it "should return information about a deleted service" do - expect(@service).to be_truthy - end - end -end diff --git a/spec/gitlab/client/snippets_spec.rb b/spec/gitlab/client/snippets_spec.rb deleted file mode 100644 index e6c94b1..0000000 --- a/spec/gitlab/client/snippets_spec.rb +++ /dev/null @@ -1,100 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".snippets" do - before do - stub_get("/projects/3/snippets", "snippets") - @snippets = Gitlab.snippets(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/snippets")).to have_been_made - end - - it "should return a paginated response of project's snippets" do - expect(@snippets).to be_a Gitlab::PaginatedResponse - expect(@snippets.first.file_name).to eq("mailer_test.rb") - end - end - - describe ".snippet" do - before do - stub_get("/projects/3/snippets/1", "snippet") - @snippet = Gitlab.snippet(3, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/snippets/1")).to have_been_made - end - - it "should return information about a snippet" do - expect(@snippet.file_name).to eq("mailer_test.rb") - expect(@snippet.author.name).to eq("John Smith") - end - end - - describe ".create_snippet" do - before do - stub_post("/projects/3/snippets", "snippet") - @snippet = Gitlab.create_snippet(3, title: 'API', file_name: 'api.rb', code: 'code') - end - - it "should get the correct resource" do - body = { title: 'API', file_name: 'api.rb', code: 'code' } - expect(a_post("/projects/3/snippets").with(body: body)).to have_been_made - end - - it "should return information about a new snippet" do - expect(@snippet.file_name).to eq("mailer_test.rb") - expect(@snippet.author.name).to eq("John Smith") - end - end - - describe ".edit_snippet" do - before do - stub_put("/projects/3/snippets/1", "snippet") - @snippet = Gitlab.edit_snippet(3, 1, file_name: 'mailer_test.rb') - end - - it "should get the correct resource" do - expect(a_put("/projects/3/snippets/1"). - with(body: { file_name: 'mailer_test.rb' })).to have_been_made - end - - it "should return information about an edited snippet" do - expect(@snippet.file_name).to eq("mailer_test.rb") - expect(@snippet.author.name).to eq("John Smith") - end - end - - describe ".delete_snippet" do - before do - stub_delete("/projects/3/snippets/1", "snippet") - @snippet = Gitlab.delete_snippet(3, 1) - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/snippets/1")).to have_been_made - end - - it "should return information about a deleted snippet" do - expect(@snippet.file_name).to eq("mailer_test.rb") - expect(@snippet.author.name).to eq("John Smith") - end - end - - describe ".snippet_content" do - before do - stub_get("/projects/3/snippets/1/raw", "snippet_content") - @snippet_content = Gitlab.snippet_content(3, 1) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/snippets/1/raw")).to have_been_made - end - - it "should return raw content of a snippet" do - expect(@snippet_content).to eq("#!/usr/bin/env ruby\n\nputs \"Cool snippet!\"\n") - end - end -end diff --git a/spec/gitlab/client/system_hooks_spec.rb b/spec/gitlab/client/system_hooks_spec.rb deleted file mode 100644 index ce32eab..0000000 --- a/spec/gitlab/client/system_hooks_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - it { should respond_to :system_hooks } - it { should respond_to :add_system_hook } - it { should respond_to :system_hook } - it { should respond_to :delete_system_hook } - - describe ".hooks" do - before do - stub_get("/hooks", "system_hooks") - @hooks = Gitlab.hooks - end - - it "should get the correct resource" do - expect(a_get("/hooks")).to have_been_made - end - - it "should return a paginated response of system hooks" do - expect(@hooks).to be_a Gitlab::PaginatedResponse - expect(@hooks.first.url).to eq("http://example.com/hook") - end - end - - describe ".add_hook" do - before do - stub_post("/hooks", "system_hook") - @hook = Gitlab.add_hook("http://example.com/hook", token: 'secret-token') - end - - it "should get the correct resource" do - expect(a_post("/hooks").with(body: hash_including(token: 'secret-token'))).to have_been_made - end - - it "should return information about a added system hook" do - expect(@hook.url).to eq("http://example.com/hook") - end - end - - describe ".hook" do - before do - stub_get("/hooks/3", "system_hook") - @hook = Gitlab.hook(3) - end - - it "should get the correct resource" do - expect(a_get("/hooks/3")).to have_been_made - end - - it "should return information about a added system hook" do - expect(@hook.url).to eq("http://example.com/hook") - end - end - - describe ".delete_hook" do - before do - stub_delete("/hooks/3", "system_hook") - @hook = Gitlab.delete_hook(3) - end - - it "should get the correct resource" do - expect(a_delete("/hooks/3")).to have_been_made - end - - it "should return information about a deleted system hook" do - expect(@hook.url).to eq("http://example.com/hook") - end - end -end diff --git a/spec/gitlab/client/tags_spec.rb b/spec/gitlab/client/tags_spec.rb deleted file mode 100644 index 1a585e7..0000000 --- a/spec/gitlab/client/tags_spec.rb +++ /dev/null @@ -1,109 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - it { should respond_to :repo_tags } - it { should respond_to :repo_tag } - it { should respond_to :repo_create_tag } - it { should respond_to :repo_delete_tag } - it { should respond_to :repo_create_release } - it { should respond_to :repo_update_release } - - describe '.tags' do - before do - stub_get("/projects/3/repository/tags", "tags") - @tags = Gitlab.tags(3) - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/tags")).to have_been_made - end - - it "should return a paginated response of repository tags" do - expect(@tags).to be_a Gitlab::PaginatedResponse - expect(@tags.map(&:name)).to eq(%w[0.0.2 0.0.1]) - end - end - - describe ".tag" do - before do - stub_get("/projects/3/repository/tags/0.0.1", "tag") - @tag = Gitlab.tag(3, "0.0.1") - end - - it "should get the correct resource" do - expect(a_get("/projects/3/repository/tags/0.0.1")).to have_been_made - end - - it "should return information about a repository tag" do - expect(@tag.name).to eq("0.0.1") - end - end - - describe ".create_tag" do - before do - stub_post("/projects/3/repository/tags", "tag_create") - @tag = Gitlab.create_tag(3, "0.0.1", "master", 'this tag is annotated', 'and it has release notes') - end - - it "should get the correct resource" do - expect(a_post("/projects/3/repository/tags")).to have_been_made - end - - it "should return information about a new repository tag" do - expect(@tag.name).to eq("0.0.1") - expect(@tag.message).to eq('this tag is annotated') - end - - it "should return detailed information" do - expect(@tag.release.description).to eq('and it has release notes') - end - end - - describe ".delete_tag" do - before do - stub_delete("/projects/3/repository/tags/0.0.1", "tag_delete") - @tag = Gitlab.delete_tag(3, "0.0.1") - end - - it "should get the correct resource" do - expect(a_delete("/projects/3/repository/tags/0.0.1")).to have_been_made - end - - it "should return information about the deleted repository tag" do - expect(@tag.tag_name).to eq("0.0.1") - end - end - - describe ".create_release" do - before do - stub_post("/projects/3/repository/tags/0.0.1/release", "release_create") - @tag = Gitlab.create_release(3, "0.0.1", "Amazing release. Wow") - end - - it "should get the correct resource" do - expect(a_post("/projects/3/repository/tags/0.0.1/release")).to have_been_made - end - - it "should return information about the tag and the release" do - expect(@tag.tag_name).to eq("0.0.1") - expect(@tag.description).to eq("Amazing release. Wow") - end - end - - describe ".update_release" do - before do - stub_put("/projects/3/repository/tags/0.0.1/release", "release_update") - @tag = Gitlab.update_release(3, "0.0.1", 'Amazing release. Wow') - end - - it "should update the correct resource" do - expect(a_put("/projects/3/repository/tags/0.0.1/release")).to have_been_made - end - - it "should return information about the tag" do - expect(@tag.tag_name).to eq("0.0.1") - expect(@tag.description).to eq('Amazing release. Wow') - end - end - -end diff --git a/spec/gitlab/client/todos_spec.rb b/spec/gitlab/client/todos_spec.rb deleted file mode 100644 index 92ebd5a..0000000 --- a/spec/gitlab/client/todos_spec.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe '.todos' do - before do - stub_get("/todos", "todos") - @todos = Gitlab.todos - end - - it "should get the correct resources" do - expect(a_get("/todos")).to have_been_made - end - - it "should return a paginated response of user's todos" do - expect(@todos).to be_a Gitlab::PaginatedResponse - end - end - - describe '.mark_todo_as_done' do - before do - stub_post("/todos/102/mark_as_done", "todo") - @todo = Gitlab.mark_todo_as_done(102) - end - - it "should get the correct resource" do - expect(a_post("/todos/102/mark_as_done")).to have_been_made - end - - it "should return information about the todo marked as done" do - expect(@todo.id).to eq(102) - expect(@todo.state).to eq('done') - end - end - - describe '.mark_all_todos_as_done' do - before do - stub_post("/todos/mark_as_done", "todos") - @todos = Gitlab.mark_all_todos_as_done - end - - it "should get the correct resources" do - expect(a_post("/todos/mark_as_done")).to have_been_made - end - end -end \ No newline at end of file diff --git a/spec/gitlab/client/users_spec.rb b/spec/gitlab/client/users_spec.rb deleted file mode 100644 index 815aabb..0000000 --- a/spec/gitlab/client/users_spec.rb +++ /dev/null @@ -1,418 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Client do - describe ".users" do - before do - stub_get("/users", "users") - @users = Gitlab.users - end - - it "should get the correct resource" do - expect(a_get("/users")).to have_been_made - end - - it "should return a paginated response of users" do - expect(@users).to be_a Gitlab::PaginatedResponse - expect(@users.first.email).to eq("john@example.com") - end - end - - describe ".user" do - context "with user ID passed" do - before do - stub_get("/users/1", "user") - @user = Gitlab.user(1) - end - - it "should get the correct resource" do - expect(a_get("/users/1")).to have_been_made - end - - it "should return information about a user" do - expect(@user.email).to eq("john@example.com") - end - end - - context "without user ID passed" do - before do - stub_get("/user", "user") - @user = Gitlab.user - end - - it "should get the correct resource" do - expect(a_get("/user")).to have_been_made - end - - it "should return information about an authorized user" do - expect(@user.email).to eq("john@example.com") - end - end - end - - describe ".create_user" do - context "when successful request" do - before do - stub_post("/users", "user") - @user = Gitlab.create_user("email", "pass") - end - - it "should get the correct resource" do - body = { email: "email", password: "pass", name: "email" } - expect(a_post("/users").with(body: body)).to have_been_made - end - - it "should return information about a created user" do - expect(@user.email).to eq("john@example.com") - end - end - - context "when bad request" do - it "should throw an exception" do - stub_post("/users", "error_already_exists", 409) - expect do - Gitlab.create_user("email", "pass") - end.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users") - end - end - end - - describe ".create_user_with_userame" do - context "when successful request" do - before do - stub_post("/users", "user") - @user = Gitlab.create_user("email", "pass", "username") - end - - it "should get the correct resource" do - body = { email: "email", password: "pass", username: "username" } - expect(a_post("/users").with(body: body)).to have_been_made - end - - it "should return information about a created user" do - expect(@user.email).to eq("john@example.com") - end - end - - context "when bad request" do - it "should throw an exception" do - stub_post("/users", "error_already_exists", 409) - expect do - Gitlab.create_user("email", "pass", "username") - end.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users") - end - end - end - - describe ".edit_user" do - before do - @options = { name: "Roberto" } - stub_put("/users/1", "user").with(body: @options) - @user = Gitlab.edit_user(1, @options) - end - - it "should get the correct resource" do - expect(a_put("/users/1").with(body: @options)).to have_been_made - end - end - - describe ".delete_user" do - before do - stub_delete("/users/1", "user") - @user = Gitlab.delete_user(1) - end - - it "should get the correct resource" do - expect(a_delete("/users/1")).to have_been_made - end - - it "should return information about a deleted user" do - expect(@user.email).to eq("john@example.com") - end - end - - describe ".block_user" do - before do - stub_post("/users/1/block", "user_block_unblock") - @result = Gitlab.block_user(1) - end - - it "should get the correct resource" do - expect(a_post("/users/1/block")).to have_been_made - end - - it "should return boolean" do - expect(@result).to eq(true) - end - end - - describe ".unblock_user" do - before do - stub_post("/users/1/unblock", "user_block_unblock") - @result = Gitlab.unblock_user(1) - end - - it "should get the correct resource" do - expect(a_post("/users/1/unblock")).to have_been_made - end - - it "should return boolean" do - expect(@result).to eq(true) - end - end - - describe ".session" do - after do - Gitlab.endpoint = 'https://api.example.com' - Gitlab.private_token = 'secret' - end - - before do - stub_request(:post, "#{Gitlab.endpoint}/session"). - to_return(body: load_fixture('session'), status: 200) - @session = Gitlab.session("email", "pass") - end - - context "when endpoint is not set" do - it "should raise Error::MissingCredentials" do - Gitlab.endpoint = nil - expect do - Gitlab.session("email", "pass") - end.to raise_error(Gitlab::Error::MissingCredentials, 'Please set an endpoint to API') - end - end - - context "when private_token is not set" do - it "should not raise Error::MissingCredentials" do - Gitlab.private_token = nil - expect { Gitlab.session("email", "pass") }.to_not raise_error - end - end - - context "when endpoint is set" do - it "should get the correct resource" do - expect(a_request(:post, "#{Gitlab.endpoint}/session")).to have_been_made - end - - it "should return information about a created session" do - expect(@session.email).to eq("john@example.com") - expect(@session.private_token).to eq("qEsq1pt6HJPaNciie3MG") - end - end - end - - describe ".ssh_keys" do - context "with user ID passed" do - before do - stub_get("/users/1/keys", "keys") - @keys = Gitlab.ssh_keys({ user_id: 1 }) - end - - it "should get the correct resource" do - expect(a_get("/users/1/keys")).to have_been_made - end - - it "should return a paginated response of SSH keys" do - expect(@keys).to be_a Gitlab::PaginatedResponse - expect(@keys.first.title).to eq("narkoz@helium") - end - end - - context "without user ID passed" do - before do - stub_get("/user/keys", "keys") - @keys = Gitlab.ssh_keys - end - - it "should get the correct resource" do - expect(a_get("/user/keys")).to have_been_made - end - - it "should return a paginated response of SSH keys" do - expect(@keys).to be_a Gitlab::PaginatedResponse - expect(@keys.first.title).to eq("narkoz@helium") - end - end - end - - describe ".ssh_key" do - before do - stub_get("/user/keys/1", "key") - @key = Gitlab.ssh_key(1) - end - - it "should get the correct resource" do - expect(a_get("/user/keys/1")).to have_been_made - end - - it "should return information about an SSH key" do - expect(@key.title).to eq("narkoz@helium") - end - end - - describe ".create_ssh_key" do - before do - stub_post("/user/keys", "key") - @key = Gitlab.create_ssh_key("title", "body") - end - - it "should get the correct resource" do - body = { title: "title", key: "body" } - expect(a_post("/user/keys").with(body: body)).to have_been_made - end - - it "should return information about a created SSH key" do - expect(@key.title).to eq("narkoz@helium") - end - end - - describe ".delete_ssh_key" do - before do - stub_delete("/user/keys/1", "key") - @key = Gitlab.delete_ssh_key(1) - end - - it "should get the correct resource" do - expect(a_delete("/user/keys/1")).to have_been_made - end - - it "should return information about a deleted SSH key" do - expect(@key.title).to eq("narkoz@helium") - end - end - - describe ".emails" do - describe "without user ID" do - before do - stub_get("/user/emails", "user_emails") - @emails = Gitlab.emails - end - - it "should get the correct resource" do - expect(a_get("/user/emails")).to have_been_made - end - - it "should return a information about a emails of user" do - email = @emails.first - expect(email.id).to eq 1 - expect(email.email).to eq("email@example.com") - end - end - - describe "with user ID" do - before do - stub_get("/users/2/emails", "user_emails") - @emails = Gitlab.emails(2) - end - - it "should get the correct resource" do - expect(a_get("/users/2/emails")).to have_been_made - end - - it "should return a information about a emails of user" do - email = @emails.first - expect(email.id).to eq 1 - expect(email.email).to eq("email@example.com") - end - end - end - - describe ".email" do - before do - stub_get("/user/emails/2", "user_email") - @email = Gitlab.email(2) - end - - it "should get the correct resource" do - expect(a_get("/user/emails/2")).to have_been_made - end - - it "should return a information about a email of user" do - expect(@email.id).to eq 1 - expect(@email.email).to eq("email@example.com") - end - end - - describe ".add_email" do - describe "without user ID" do - before do - stub_post("/user/emails", "user_email") - @email = Gitlab.add_email("email@example.com") - end - - it "should get the correct resource" do - body = { email: "email@example.com" } - expect(a_post("/user/emails").with(body: body)).to have_been_made - end - - it "should return information about a new email" do - expect(@email.id).to eq(1) - expect(@email.email).to eq("email@example.com") - end - end - - describe "with user ID" do - before do - stub_post("/users/2/emails", "user_email") - @email = Gitlab.add_email("email@example.com", 2) - end - - it "should get the correct resource" do - body = { email: "email@example.com" } - expect(a_post("/users/2/emails").with(body: body)).to have_been_made - end - - it "should return information about a new email" do - expect(@email.id).to eq(1) - expect(@email.email).to eq("email@example.com") - end - end - end - - describe ".delete_email" do - describe "without user ID" do - before do - stub_delete("/user/emails/1", "user_email") - @email = Gitlab.delete_email(1) - end - - it "should get the correct resource" do - expect(a_delete("/user/emails/1")).to have_been_made - end - - it "should return information about a deleted email" do - expect(@email).to be_truthy - end - end - - describe "with user ID" do - before do - stub_delete("/users/2/emails/1", "user_email") - @email = Gitlab.delete_email(1, 2) - end - - it "should get the correct resource" do - expect(a_delete("/users/2/emails/1")).to have_been_made - end - - it "should return information about a deleted email" do - expect(@email).to be_truthy - end - end - end - - describe ".user_search" do - before do - stub_get("/users?search=User", "user_search") - @users = Gitlab.user_search('User') - end - - it "should get the correct resource" do - expect(a_get("/users?search=User")).to have_been_made - end - - it "should return an array of users found" do - expect(@users.first.id).to eq(1) - expect(@users.last.id).to eq(2) - end - end -end diff --git a/spec/gitlab/error_spec.rb b/spec/gitlab/error_spec.rb deleted file mode 100644 index 7a9e47e..0000000 --- a/spec/gitlab/error_spec.rb +++ /dev/null @@ -1,45 +0,0 @@ -require "spec_helper" - -describe Gitlab::Error do - describe "#handle_message" do - require "stringio" - - before do - request_object = HTTParty::Request.new(Net::HTTP::Get, '/') - response_object = Net::HTTPOK.new('1.1', 200, 'OK') - body = StringIO.new("{foo:'bar'}") - def body.message; self.string; end - - parsed_response = lambda { body } - response_object['last-modified'] = Date.new(2010, 1, 15).to_s - response_object['content-length'] = "1024" - - response = HTTParty::Response.new(request_object, response_object, parsed_response, body: body) - @error = Gitlab::Error::ResponseError.new(response) - - @array = Array.new(['First message.', 'Second message.']) - @obj_h = Gitlab::ObjectifiedHash.new(user: ['not set'], - password: ['too short'], - embed_entity: { foo: ['bar'], sna: ['fu'] }) - end - - context "when passed an ObjectifiedHash" do - it "should return a joined string of error messages sorted by key" do - expect(@error.send(:handle_message, @obj_h)).to eq("'embed_entity' (foo: bar) (sna: fu), 'password' too short, 'user' not set") - end - end - - context "when passed an Array" do - it "should return a joined string of messages" do - expect(@error.send(:handle_message, @array)).to eq("First message. Second message.") - end - end - - context "when passed a String" do - it "should return the String untouched" do - error = 'this is an error string' - expect(@error.send(:handle_message, error)).to eq('this is an error string') - end - end - end -end diff --git a/spec/gitlab/file_response_spec.rb b/spec/gitlab/file_response_spec.rb deleted file mode 100644 index 455d47d..0000000 --- a/spec/gitlab/file_response_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'spec_helper' - -describe Gitlab::FileResponse do - before do - @file_response = Gitlab::FileResponse.new StringIO.new("", 'rb+') - end - - context '.empty?' do - it "shoudl return false" do - expect(@file_response.empty?).to be false - end - end - - context '.to_hash' do - it "should have `filename` key and `data` key" do - h = @file_response.to_hash - expect(h.has_key?(:filename)).to be_truthy - expect(h.has_key?(:data)).to be_truthy - end - end - - context '.parse_headers!' do - it "should parse headers" do - @file_response.parse_headers!('Content-Disposition' => 'attachment; filename=artifacts.zip') - expect(@file_response.filename).to eq "artifacts.zip" - end - - it "should handle quoted filenames" do - @file_response.parse_headers!('Content-Disposition' => 'attachment; filename="artifacts.zip"') - expect(@file_response.filename).to eq "artifacts.zip" - end - end -end diff --git a/spec/gitlab/help_spec.rb b/spec/gitlab/help_spec.rb deleted file mode 100644 index b8d2d7c..0000000 --- a/spec/gitlab/help_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Help do - describe ".ri_cmd" do - context "ri command found" do - it "should return the path to RI" do - allow(Gitlab::Help).to receive(:`).with(/which ri/).and_return('/usr/bin/ri') - expect(Gitlab::Help.ri_cmd).to eq('/usr/bin/ri') - end - end - - context "ri command NOT found" do - it "should raise" do - allow(Gitlab::Help).to receive(:`).with(/which ri/).and_return('') - expect { Gitlab::Help.ri_cmd }.to raise_error RuntimeError - end - end - end - - describe ".change_help_output!" do - before do - @cmd = "create_branch" - @help_output = "Gitlab.#{@cmd}(4, 'new-branch', 'master')" - @help_output_with_options = "Gitlab.groups({ per_page: 3 })" - end - it "should return a String of modified output" do - Gitlab::Help.change_help_output! @cmd, @help_output - expect(@help_output).to eq("Gitlab.create_branch 4 'new-branch' 'master'") - end - it "should format options hash and return a String of modified output" do - Gitlab::Help.change_help_output! 'groups', @help_output_with_options - expect(@help_output_with_options).to eq("Gitlab.groups \"{ per_page: 3 }\"") - end - end - - describe ".namespace" do - before do - @cmd = 'create_tag' - @namespace = Gitlab::Help.namespace @cmd - end - it "should return the full namespace for a command" do - expect(@namespace).to be_a String - expect(@namespace).to eq("Gitlab::Client::Tags.#{@cmd}") - end - end -end diff --git a/spec/gitlab/objectified_hash_spec.rb b/spec/gitlab/objectified_hash_spec.rb deleted file mode 100644 index c3f08eb..0000000 --- a/spec/gitlab/objectified_hash_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'spec_helper' - -describe Gitlab::ObjectifiedHash do - before do - @hash = { a: 1, b: 2, 'string' => 'string', symbol: :symbol } - @oh = Gitlab::ObjectifiedHash.new @hash - end - - it "should objectify hash" do - expect(@oh.a).to eq(@hash[:a]) - expect(@oh.b).to eq(@hash[:b]) - end - - describe "#to_hash" do - it "should return an original hash" do - expect(@oh.to_hash).to eq(@hash) - end - - it "should have an alias #to_h" do - expect(@oh.respond_to?(:to_h)).to be_truthy - end - end - - describe "#inspect" do - it "should return a formatted string" do - pretty_string = "#<#{@oh.class.name}:#{@oh.object_id} {hash: #{@hash}}" - expect(@oh.inspect).to eq(pretty_string) - end - end - - describe "#respond_to" do - it "should return true for methods this object responds to through method_missing as sym" do - expect(@oh.respond_to?(:a)).to be_truthy - end - - it "should return true for methods this object responds to through method_missing as string" do - expect(@oh.respond_to?('string')).to be_truthy - end - - it "should not care if you use a string or symbol to reference a method" do - expect(@oh.respond_to?(:string)).to be_truthy - end - - it "should not care if you use a string or symbol to reference a method" do - expect(@oh.respond_to?('symbol')).to be_truthy - end - end -end diff --git a/spec/gitlab/page_links_spec.rb b/spec/gitlab/page_links_spec.rb deleted file mode 100644 index 973c9b9..0000000 --- a/spec/gitlab/page_links_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'spec_helper' - -describe Gitlab::PageLinks do - before do - @page_links = Gitlab::PageLinks.new('Link' => "; rel=\"first\", ; rel=\"last\", ; rel=\"prev\", ; rel=\"next\"") - end - - context '.extract_links' do - it 'should extract link header appropriately' do - expect(@page_links.last).to eql 'http://example.com/api/v3/projects?page=20&per_page=5' - expect(@page_links.first).to eql 'http://example.com/api/v3/projects?page=1&per_page=5' - expect(@page_links.next).to eql 'http://example.com/api/v3/projects?page=9&per_page=5' - expect(@page_links.prev).to eql 'http://example.com/api/v3/projects?page=7&per_page=5' - end - end -end diff --git a/spec/gitlab/paginated_response_spec.rb b/spec/gitlab/paginated_response_spec.rb deleted file mode 100644 index 72c17c8..0000000 --- a/spec/gitlab/paginated_response_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'spec_helper' - -describe Gitlab::PaginatedResponse do - before do - array = [1, 2, 3, 4] - @paginated_response = Gitlab::PaginatedResponse.new array - end - - it "should respond to *_page and has_*_page methods" do - expect(@paginated_response).to respond_to :first_page - expect(@paginated_response).to respond_to :last_page - expect(@paginated_response).to respond_to :next_page - expect(@paginated_response).to respond_to :prev_page - expect(@paginated_response).to respond_to :has_first_page? - expect(@paginated_response).to respond_to :has_last_page? - expect(@paginated_response).to respond_to :has_next_page? - expect(@paginated_response).to respond_to :has_prev_page? - end - - context '.parse_headers!' do - it "should parse headers" do - @paginated_response.parse_headers!('Link' => "; rel=\"first\", ; rel=\"last\"") - client = @paginated_response.client = double('client') - first_page_response = double('first_page_response') - last_page_response = double('last_page_response') - allow(client).to receive(:endpoint).and_return("http://example.com/api/v3") - allow(client).to receive(:get).with("/projects?page=1&per_page=5").and_return(first_page_response) - allow(client).to receive(:get).with("/projects?page=20&per_page=5").and_return(last_page_response) - expect(@paginated_response.has_first_page?).to be true - expect(@paginated_response.has_last_page?).to be true - expect(@paginated_response.has_next_page?).to be false - expect(@paginated_response.has_prev_page?).to be false - expect(@paginated_response.first_page).to be first_page_response - expect(@paginated_response.last_page).to be last_page_response - expect(@paginated_response.next_page).to be_nil - expect(@paginated_response.prev_page).to be_nil - end - end - - context '.each_page' do - it "should iterate pages" do - next_page = double('next_page') - allow(@paginated_response).to receive(:has_next_page?).and_return(true) - allow(@paginated_response).to receive(:next_page).and_return(next_page) - allow(next_page).to receive(:has_next_page?).and_return(false) - expect { |b| @paginated_response.each_page(&b) }.to yield_successive_args(@paginated_response, next_page) - end - end - - context '.auto_paginate' do - it "should returns an array if block is not given" do - next_page = double('next_page') - allow(@paginated_response).to receive(:has_next_page?).and_return(true) - allow(@paginated_response).to receive(:next_page).and_return(next_page) - allow(next_page).to receive(:has_next_page?).and_return(false) - allow(next_page).to receive(:to_ary).and_return([5, 6, 7, 8]) - expect(@paginated_response.auto_paginate).to contain_exactly(1, 2, 3, 4, 5, 6, 7, 8) - end - end -end diff --git a/spec/gitlab/request_spec.rb b/spec/gitlab/request_spec.rb deleted file mode 100644 index 111a6f4..0000000 --- a/spec/gitlab/request_spec.rb +++ /dev/null @@ -1,73 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Request do - it { should respond_to :get } - it { should respond_to :post } - it { should respond_to :put } - it { should respond_to :delete } - before do - @request = Gitlab::Request.new - end - - describe ".default_options" do - it "should have default values" do - default_options = Gitlab::Request.default_options - expect(default_options).to be_a Hash - expect(default_options[:parser]).to be_a Proc - expect(default_options[:format]).to eq(:json) - expect(default_options[:headers]).to eq('Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded') - expect(default_options[:default_params]).to be_nil - end - end - - describe ".parse" do - it "should return ObjectifiedHash" do - body = JSON.unparse(a: 1, b: 2) - expect(Gitlab::Request.parse(body)).to be_an Gitlab::ObjectifiedHash - expect(Gitlab::Request.parse("true")).to be true - expect(Gitlab::Request.parse("false")).to be false - - expect { Gitlab::Request.parse("string") }.to raise_error(Gitlab::Error::Parsing) - end - end - - describe "#set_request_defaults" do - context "when endpoint is not set" do - it "should raise Error::MissingCredentials" do - @request.endpoint = nil - expect do - @request.set_request_defaults - end.to raise_error(Gitlab::Error::MissingCredentials, 'Please set an endpoint to API') - end - end - - context "when endpoint is set" do - before(:each) do - @request.endpoint = 'http://rabbit-hole.example.org' - end - - it "should set default_params" do - @request.set_request_defaults('sudoer') - expect(Gitlab::Request.default_params).to eq(sudo: 'sudoer') - end - end - end - - describe "#set_authorization_header" do - it "should raise MissingCredentials when auth_token and private_token are not set" do - expect do - @request.send(:set_authorization_header, {}) - end.to raise_error(Gitlab::Error::MissingCredentials) - end - - it "should set the correct header when given a private_token" do - @request.private_token = 'ys9BtunN3rDKbaJCYXaN' - expect(@request.send(:set_authorization_header, {})).to eq("PRIVATE-TOKEN" => 'ys9BtunN3rDKbaJCYXaN') - end - - it "should set the correct header when setting an auth_token via the private_token config option" do - @request.private_token = '3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603' - expect(@request.send(:set_authorization_header, {})).to eq("Authorization" => "Bearer 3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603") - end - end -end diff --git a/spec/gitlab/shell_history_spec.rb b/spec/gitlab/shell_history_spec.rb deleted file mode 100644 index 897f335..0000000 --- a/spec/gitlab/shell_history_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'spec_helper' -require 'tempfile' - -describe Gitlab::Shell::History do - context 'saving to a file' do - before do - @file = Tempfile.new('.gitlab_shell_history') - @history = Gitlab::Shell::History.new(file_path: @file.path) - end - - after { @file.close(true) } - - it 'saves the lines' do - @history << 'party on, dudes' - @history << 'be excellent to each other' - @history.save - expect(File.read @file.path). - to eq("party on, dudes\nbe excellent to each other\n") - end - - it 'has the lines' do - @history << 'party on, dudes' - @history << 'be excellent to each other' - expect(@history.lines). - to eq(["party on, dudes", "be excellent to each other"]) - end - - it 'limits the lines to GITLAB_HISTFILESIZE' do - ENV['GITLAB_HISTFILESIZE'] = '2' - @history << 'bogus' - @history << 'party on, dudes' - @history << 'be excellent to each other' - @history.save - expect(@history.lines). - to eq(["party on, dudes", "be excellent to each other"]) - expect(File.read @file.path). - to eq("party on, dudes\nbe excellent to each other\n") - end - end - - context 'loading a file' do - before do - @file = load_fixture('shell_history') - @history = Gitlab::Shell::History.new(file_path: @file.path) - end - - it 'has the lines' do - @history.load - expect(@history.lines). - to eq(["party on, dudes", "be excellent to each other"]) - end - end -end diff --git a/spec/gitlab/shell_spec.rb b/spec/gitlab/shell_spec.rb deleted file mode 100644 index ac6f318..0000000 --- a/spec/gitlab/shell_spec.rb +++ /dev/null @@ -1,80 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Shell do - before do - Gitlab::Shell.setup - end - - describe ".execute" do - context "invalid command" do - it "should raise" do - expect { Gitlab::Shell.execute 'foobar', [] }.to raise_error(RuntimeError) - end - end - end - - describe ".history" do - before do - @history = Gitlab::Shell.history - end - - it "should return a Gitlab::Shell::History instance" do - expect(@history).to be_a Gitlab::Shell::History - end - it "should respond to :save" do - expect(@history).to respond_to :save - end - it "should respond to :load" do - expect(@history).to respond_to :load - end - it "should respond to :<<" do - expect(@history).to respond_to :<< - end - end - - describe ".setup" do - it "should set the Readline completion_proc" do - completion = Readline.completion_proc - expect(completion).to be_truthy - expect(completion).to be_a Proc - end - it "should set the Readline completion_append_character" do - completion_character = Readline.completion_append_character - expect(completion_character).to eq(' ') - end - end - - describe ".completion" do - before do - @comp = Gitlab::Shell.completion - end - it "should return a Proc object" do - expect(@comp).to be_a Proc - end - context "called with an argument" do - it "should return an Array of matching commands" do - completed_cmds = @comp.call 'group' - expect(completed_cmds).to be_a Array - expect(completed_cmds.sort).to eq(%w(group group_members group_projects group_search groups)) - end - end - end - - describe ".parse_input" do - context "with arguments" do - it "should set command & arguments" do - Gitlab::Shell.parse_input('create_branch 1 "api" "master"') - expect(Gitlab::Shell.command).to eq('create_branch') - expect(Gitlab::Shell.arguments).to eq(%w(1 api master)) - end - end - - context "without arguments" do - it 'should set command & empty arguments' do - Gitlab::Shell.parse_input('exit') - expect(Gitlab::Shell.command).to eq('exit') - expect(Gitlab::Shell.arguments).to be_empty - end - end - end -end diff --git a/spec/gitlab_spec.rb b/spec/gitlab_spec.rb deleted file mode 100644 index b769f40..0000000 --- a/spec/gitlab_spec.rb +++ /dev/null @@ -1,97 +0,0 @@ -require 'spec_helper' - -describe Gitlab do - after { Gitlab.reset } - - describe ".client" do - it "should be a Gitlab::Client" do - expect(Gitlab.client).to be_a Gitlab::Client - end - - it "should not override each other" do - client1 = Gitlab.client(endpoint: 'https://api1.example.com', private_token: '001') - client2 = Gitlab.client(endpoint: 'https://api2.example.com', private_token: '002') - expect(client1.endpoint).to eq('https://api1.example.com') - expect(client2.endpoint).to eq('https://api2.example.com') - expect(client1.private_token).to eq('001') - expect(client2.private_token).to eq('002') - end - - it "should set private_token to the auth_token when provided" do - client = Gitlab.client(endpoint: 'https://api2.example.com', auth_token: '3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603') - expect(client.private_token).to eq('3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603') - end - end - - describe ".actions" do - it "should return an array of client methods" do - actions = Gitlab.actions - expect(actions).to be_an Array - expect(actions.first).to be_a Symbol - expect(actions.sort.first).to eq(:accept_merge_request) - end - end - - describe ".endpoint=" do - it "should set endpoint" do - Gitlab.endpoint = 'https://api.example.com' - expect(Gitlab.endpoint).to eq('https://api.example.com') - end - end - - describe ".private_token=" do - it "should set private_token" do - Gitlab.private_token = 'secret' - expect(Gitlab.private_token).to eq('secret') - end - end - - describe ".auth_token=" do - it "should set auth_token", focus: true do - Gitlab.auth_token = 'auth_secret' - expect(Gitlab.private_token).to eq('auth_secret') - end - end - - describe ".sudo=" do - it "should set sudo" do - Gitlab.sudo = 'user' - expect(Gitlab.sudo).to eq('user') - end - end - - describe ".user_agent" do - it "should return default user_agent" do - expect(Gitlab.user_agent).to eq(Gitlab::Configuration::DEFAULT_USER_AGENT) - end - end - - describe ".user_agent=" do - it "should set user_agent" do - Gitlab.user_agent = 'Custom User Agent' - expect(Gitlab.user_agent).to eq('Custom User Agent') - end - end - - describe ".configure" do - Gitlab::Configuration::VALID_OPTIONS_KEYS.each do |key| - it "should set #{key}" do - Gitlab.configure do |config| - config.send("#{key}=", key) - expect(Gitlab.send(key)).to eq(key) - end - end - end - end - - describe ".http_proxy" do - it "delegates the method to Gitlab::Request" do - Gitlab.endpoint = 'https://api.example.com' - request = class_spy(Gitlab::Request).as_stubbed_const - - Gitlab.http_proxy('fazbearentertainment.com', 1987, 'ffazbear', 'itsme') - expect(request).to have_received(:http_proxy). - with('fazbearentertainment.com', 1987, 'ffazbear', 'itsme') - end - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index 1ed7ddb..0000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -1,74 +0,0 @@ -require 'rspec' -require 'webmock/rspec' - -require File.expand_path('../../lib/gitlab', __FILE__) -require File.expand_path('../../lib/gitlab/cli', __FILE__) - -def capture_output - out = StringIO.new - $stdout = out - $stderr = out - yield - $stdout = STDOUT - $stderr = STDERR - out.string -end - -def load_fixture(name) - File.new(File.dirname(__FILE__) + "/fixtures/#{name}.json") -end - -RSpec.configure do |config| - config.before(:all) do - Gitlab.endpoint = 'https://api.example.com' - Gitlab.private_token = 'secret' - end -end - -# GET -def stub_get(path, fixture, status_code=200) - stub_request(:get, "#{Gitlab.endpoint}#{path}"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }). - to_return(body: load_fixture(fixture), status: status_code) -end - -def a_get(path) - a_request(:get, "#{Gitlab.endpoint}#{path}"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }) -end - -# POST -def stub_post(path, fixture, status_code=200) - stub_request(:post, "#{Gitlab.endpoint}#{path}"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }). - to_return(body: load_fixture(fixture), status: status_code) -end - -def a_post(path) - a_request(:post, "#{Gitlab.endpoint}#{path}"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }) -end - -# PUT -def stub_put(path, fixture) - stub_request(:put, "#{Gitlab.endpoint}#{path}"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }). - to_return(body: load_fixture(fixture)) -end - -def a_put(path) - a_request(:put, "#{Gitlab.endpoint}#{path}"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }) -end - -# DELETE -def stub_delete(path, fixture) - stub_request(:delete, "#{Gitlab.endpoint}#{path}"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }). - to_return(body: load_fixture(fixture)) -end - -def a_delete(path) - a_request(:delete, "#{Gitlab.endpoint}#{path}"). - with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }) -end