Commit 5faa6e75 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'master' into project-header-titles

parents 7b10bd95 0aec0d53
...@@ -52,6 +52,7 @@ v 8.0.0 (unreleased) ...@@ -52,6 +52,7 @@ v 8.0.0 (unreleased)
- Added service API endpoint to retrieve service parameters (Petheő Bence) - Added service API endpoint to retrieve service parameters (Petheő Bence)
- Add FogBugz project import (Jared Szechy) - Add FogBugz project import (Jared Szechy)
- Sort users autocomplete lists by user (Allister Antosik) - Sort users autocomplete lists by user (Allister Antosik)
- Webhook for issue now contains repository field (Jungkook Park)
v 7.14.3 v 7.14.3
- No changes - No changes
......
module Ci
class HelpsController < Ci::ApplicationController
skip_filter :check_config
def show
end
def oauth2
if valid_config?
redirect_to ci_root_path
else
render layout: 'ci/empty'
end
end
end
end
...@@ -18,12 +18,6 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -18,12 +18,6 @@ class Projects::BlobController < Projects::ApplicationController
before_action :after_edit_path, only: [:edit, :update] before_action :after_edit_path, only: [:edit, :update]
def new def new
@title = 'Upload'
@placeholder = 'Upload new file'
@button_title = 'Upload file'
@form_path = namespace_project_create_blob_path(@project.namespace, @project, @id)
@method = :post
commit unless @repository.empty? commit unless @repository.empty?
end end
...@@ -46,11 +40,6 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -46,11 +40,6 @@ class Projects::BlobController < Projects::ApplicationController
end end
def show def show
@title = "Replace #{@blob.name}"
@placeholder = @title
@button_title = 'Replace file'
@form_path = namespace_project_update_blob_path(@project.namespace, @project, @id)
@method = :put
end end
def edit def edit
......
...@@ -13,7 +13,9 @@ module ApplicationHelper ...@@ -13,7 +13,9 @@ module ApplicationHelper
# current_controller?(:commits) # => false # current_controller?(:commits) # => false
# current_controller?(:commits, :tree) # => true # current_controller?(:commits, :tree) # => true
def current_controller?(*args) def current_controller?(*args)
args.any? { |v| v.to_s.downcase == controller.controller_name } args.any? do |v|
v.to_s.downcase == controller.controller_name || v.to_s.downcase == controller.controller_path
end
end end
# Check if a particular action is the current one # Check if a particular action is the current one
......
...@@ -4,118 +4,10 @@ module Ci ...@@ -4,118 +4,10 @@ module Ci
image_tag 'ci/loader.gif', alt: 'Loading' image_tag 'ci/loader.gif', alt: 'Loading'
end end
# Navigation link helper
#
# Returns an `li` element with an 'active' class if the supplied
# controller(s) and/or action(s) are currently active. The content of the
# element is the value passed to the block.
#
# options - The options hash used to determine if the element is "active" (default: {})
# :controller - One or more controller names to check (optional).
# :action - One or more action names to check (optional).
# :path - A shorthand path, such as 'dashboard#index', to check (optional).
# :html_options - Extra options to be passed to the list element (optional).
# block - An optional block that will become the contents of the returned
# `li` element.
#
# When both :controller and :action are specified, BOTH must match in order
# to be marked as active. When only one is given, either can match.
#
# Examples
#
# # Assuming we're on TreeController#show
#
# # Controller matches, but action doesn't
# nav_link(controller: [:tree, :refs], action: :edit) { "Hello" }
# # => '<li>Hello</li>'
#
# # Controller matches
# nav_link(controller: [:tree, :refs]) { "Hello" }
# # => '<li class="active">Hello</li>'
#
# # Shorthand path
# nav_link(path: 'tree#show') { "Hello" }
# # => '<li class="active">Hello</li>'
#
# # Supplying custom options for the list element
# nav_link(controller: :tree, html_options: {class: 'home'}) { "Hello" }
# # => '<li class="home active">Hello</li>'
#
# Returns a list item element String
def nav_link(options = {}, &block)
if path = options.delete(:path)
if path.respond_to?(:each)
c = path.map { |p| p.split('#').first }
a = path.map { |p| p.split('#').last }
else
c, a, _ = path.split('#')
end
else
c = options.delete(:controller)
a = options.delete(:action)
end
if c && a
# When given both options, make sure BOTH are active
klass = current_controller?(*c) && current_action?(*a) ? 'active' : ''
else
# Otherwise check EITHER option
klass = current_controller?(*c) || current_action?(*a) ? 'active' : ''
end
# Add our custom class into the html_options, which may or may not exist
# and which may or may not already have a :class key
o = options.delete(:html_options) || {}
o[:class] ||= ''
o[:class] += ' ' + klass
o[:class].strip!
if block_given?
content_tag(:li, capture(&block), o)
else
content_tag(:li, nil, o)
end
end
# Check if a particular controller is the current one
#
# args - One or more controller names to check
#
# Examples
#
# # On TreeController
# current_controller?(:tree) # => true
# current_controller?(:commits) # => false
# current_controller?(:commits, :tree) # => true
def current_controller?(*args)
args.any? { |v| v.to_s.downcase == controller.controller_name }
end
# Check if a particular action is the current one
#
# args - One or more action names to check
#
# Examples
#
# # On Projects#new
# current_action?(:new) # => true
# current_action?(:create) # => false
# current_action?(:new, :create) # => true
def current_action?(*args)
args.any? { |v| v.to_s.downcase == action_name }
end
def date_from_to(from, to) def date_from_to(from, to)
"#{from.to_s(:short)} - #{to.to_s(:short)}" "#{from.to_s(:short)} - #{to.to_s(:short)}"
end end
def body_data_page
path = controller.controller_path.split('/')
namespace = path.first if path.second
[namespace, controller.controller_name, controller.action_name].compact.join(":")
end
def duration_in_words(finished_at, started_at) def duration_in_words(finished_at, started_at)
if finished_at && started_at if finished_at && started_at
interval_in_seconds = finished_at.to_i - started_at.to_i interval_in_seconds = finished_at.to_i - started_at.to_i
......
...@@ -140,6 +140,12 @@ module Issuable ...@@ -140,6 +140,12 @@ module Issuable
{ {
object_kind: self.class.name.underscore, object_kind: self.class.name.underscore,
user: user.hook_attrs, user: user.hook_attrs,
repository: {
name: project.name,
url: project.url_to_repo,
description: project.description,
homepage: project.web_url
},
object_attributes: hook_attrs object_attributes: hook_attrs
} }
end end
......
.welcome-block
%h1
Welcome to GitLab CI
%p
GitLab CI integrates with your GitLab installation and runs tests for your projects.
%h3 You need only 2 steps to set it up
%ol
%li
In the GitLab admin area under OAuth applications create a new entry. The redirect url should be
%code= callback_ci_user_sessions_url
%li
Update the GitLab CI config with the application id and the application secret from GitLab.
%li
Restart your GitLab CI instance
%li
Refresh this page when GitLab CI has started again
.jumbotron
%h2
GitLab CI
%span= GitlabCi::VERSION
%small= GitlabCi::REVISION
%p
GitLab CI integrates with your GitLab installation and run tests for your projects.
%br
Login with your GitLab account, add a project with one click and enjoy running your tests.
%br
Read more about GitLab CI at #{link_to "about.gitlab.com/gitlab-ci", "https://about.gitlab.com/gitlab-ci/", target: "_blank"}.
.bs-callout.bs-callout-success
%h4
= link_to 'https://gitlab.com/gitlab-org/gitlab-ci/blob/master/doc/api' do
%i.fa.fa-cogs
API
%p Explore how you can access GitLab CI via the API.
.bs-callout.bs-callout-info
%h4
= link_to 'https://gitlab.com/gitlab-org/gitlab-ci/tree/master/doc/examples' do
%i.fa.fa-info-sign
Build script examples
%p This includes the build script we use to test GitLab CE.
.bs-callout.bs-callout-danger
%h4
= link_to 'https://gitlab.com/gitlab-org/gitlab-ci/issues' do
%i.fa.fa-bug
Issue tracker
%p Reports about recent bugs and problems..
.bs-callout.bs-callout-warning
%h4
= link_to 'http://feedback.gitlab.com/forums/176466-general/category/64310-gitlab-ci' do
%i.fa.fa-thumbs-up
Feedback forum
%p Suggest improvements or new features for GitLab CI.
%ul.nav.nav-sidebar %ul.nav.nav-sidebar
= nav_link do = nav_link do
= link_to ci_root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do = link_to admin_root_path, title: 'Back to admin', data: {placement: 'right'}, class: 'back-link' do
= icon('caret-square-o-left fw') = icon('caret-square-o-left fw')
%span %span
Back to dashboard Back to admin
%li.separate-item %li.separate-item
= nav_link path: 'projects#index' do = nav_link path: 'projects#index' do
......
%ul.nav.nav-sidebar
= nav_link do
= link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do
= icon('caret-square-o-left fw')
%span
Back to GitLab
%li.separate-item
= nav_link path: 'projects#index' do
= link_to ci_root_path do
%i.fa.fa-home
%span
Projects
- if current_user && current_user.is_admin?
%li
= link_to ci_admin_projects_path do
%i.fa.fa-cogs
%span
Admin
= nav_link path: "helps#show" do
= link_to ci_help_path do
%i.fa.fa-info
%span
Help
...@@ -8,4 +8,4 @@ ...@@ -8,4 +8,4 @@
- else - else
= render "layouts/header/public", title: header_title = render "layouts/header/public", title: header_title
= render 'layouts/ci/page', sidebar: 'nav_dashboard' = render 'layouts/ci/page'
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
= icon('dashboard fw') = icon('dashboard fw')
%span %span
Overview Overview
= nav_link(controller: :projects) do = nav_link(controller: [:admin, :projects]) do
= link_to admin_namespaces_projects_path, title: 'Projects', data: {placement: 'right'} do = link_to admin_namespaces_projects_path, title: 'Projects', data: {placement: 'right'} do
= icon('cube fw') = icon('cube fw')
%span %span
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
= icon('key fw') = icon('key fw')
%span %span
Deploy Keys Deploy Keys
= nav_link do
= link_to ci_admin_projects_path, title: 'Continuous Integration', data: {placement: 'right'} do
= icon('building fw')
%span
Continuous Integration
= nav_link(controller: :logs) do = nav_link(controller: :logs) do
= link_to admin_logs_path, title: 'Logs', data: {placement: 'right'} do = link_to admin_logs_path, title: 'Logs', data: {placement: 'right'} do
= icon('file-text fw') = icon('file-text fw')
......
%ul.nav.nav-sidebar %ul.nav.nav-sidebar
= nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: {class: 'home'}) do
= link_to root_path, title: 'Projects', data: {placement: 'right'} do = link_to root_path, title: 'Projects', data: {placement: 'right'} do
= icon('home fw') = icon('home fw')
%span %span
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
%span %span
Merge Requests Merge Requests
%span.count= current_user.assigned_merge_requests.opened.count %span.count= current_user.assigned_merge_requests.opened.count
= nav_link(path: 'ci/projects#index') do
= link_to ci_projects_path, title: 'Continuous Integration', data: {placement: 'right'} do
= icon('building fw')
%span
Continuous Integration
= nav_link(controller: :snippets) do = nav_link(controller: :snippets) do
= link_to dashboard_snippets_path, title: 'Your snippets', data: {placement: 'right'} do = link_to dashboard_snippets_path, title: 'Your snippets', data: {placement: 'right'} do
= icon('clipboard fw') = icon('clipboard fw')
...@@ -41,13 +46,10 @@ ...@@ -41,13 +46,10 @@
= icon('question-circle fw') = icon('question-circle fw')
%span %span
Help Help
%li.separate-item
= nav_link(controller: :profile) do = nav_link(controller: :profile) do
= link_to profile_path, title: 'Profile settings', data: {placement: 'bottom'} do = link_to profile_path, title: 'Profile settings', data: {placement: 'bottom'} do
= icon('user fw') = icon('user fw')
%span %span
Profile Settings Profile Settings
= nav_link(controller: :ci) do
= link_to ci_root_path, title: 'Continuous Integration', data: {placement: 'right'} do
= icon('building fw')
%span
GitLab CI
...@@ -76,6 +76,13 @@ ...@@ -76,6 +76,13 @@
Merge Requests Merge Requests
%span.count.merge_counter= @project.merge_requests.opened.count %span.count.merge_counter= @project.merge_requests.opened.count
- if @project.gitlab_ci?
= nav_link(controller: [:ci, :project]) do
= link_to ci_project_path(@project.gitlab_ci_project), title: 'Continuous Integration', data: {placement: 'right'} do
= icon('building fw')
%span
Continuous Integration
- if project_nav_tab? :settings - if project_nav_tab? :settings
= nav_link(controller: [:project_members, :teams]) do = nav_link(controller: [:project_members, :teams]) do
= link_to namespace_project_project_members_path(@project.namespace, @project), title: 'Members', class: 'team-tab tab', data: {placement: 'right'} do = link_to namespace_project_project_members_path(@project.namespace, @project), title: 'Members', class: 'team-tab tab', data: {placement: 'right'} do
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
.modal-content .modal-content
.modal-header .modal-header
%a.close{href: "#", "data-dismiss" => "modal"} × %a.close{href: "#", "data-dismiss" => "modal"} ×
%h3.page-title #{@title} %h3.page-title #{title}
%p.light %p.light
From branch From branch
%strong= @ref %strong= @ref
.modal-body .modal-body
= form_tag @form_path, method: @method, class: 'blob-file-upload-form-js form-horizontal' do = form_tag form_path, method: method, class: 'blob-file-upload-form-js form-horizontal' do
.dropzone .dropzone
.dropzone-previews.blob-upload-dropzone-previews .dropzone-previews.blob-upload-dropzone-previews
%p.dz-message.light %p.dz-message.light
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
%br %br
.dropzone-alerts{class: "alert alert-danger data", style: "display:none"} .dropzone-alerts{class: "alert alert-danger data", style: "display:none"}
= render 'shared/commit_message_container', params: params, = render 'shared/commit_message_container', params: params,
placeholder: @placeholder placeholder: placeholder
.form-group .form-group
.col-sm-offset-2.col-sm-10 .col-sm-offset-2.col-sm-10
= button_tag @button_title, class: 'btn btn-small btn-primary btn-upload-file', id: 'submit-all' = button_tag button_title, class: 'btn btn-small btn-primary btn-upload-file', id: 'submit-all'
= link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal" = link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal"
:coffeescript :coffeescript
disableButtonIfEmptyField $('.blob-file-upload-form-js').find('#commit_message'), '.btn-upload-file' disableButtonIfEmptyField $('.blob-file-upload-form-js').find('#commit_message'), '.btn-upload-file'
new BlobFileDropzone($('.blob-file-upload-form-js'), '#{@method}') new BlobFileDropzone($('.blob-file-upload-form-js'), '#{method}')
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
{ class: 'upload-link', 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal'} { class: 'upload-link', 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal'}
an existing one an existing one
= render 'projects/blob/upload' = render 'projects/blob/upload', title: 'Upload', placeholder: 'Upload new file', button_title: 'Upload file', form_path: namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post
.file-editor .file-editor
= form_tag(namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post, class: 'form-horizontal form-new-file js-requires-input') do = form_tag(namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post, class: 'form-horizontal form-new-file js-requires-input') do
......
...@@ -11,4 +11,8 @@ ...@@ -11,4 +11,8 @@
- if allowed_tree_edit? - if allowed_tree_edit?
= render 'projects/blob/remove' = render 'projects/blob/remove'
= render 'projects/blob/upload'
- title = "Replace #{@blob.name}"
= render 'projects/blob/upload', title: title, placeholder: title,
button_title: 'Replace file', form_path: namespace_project_update_blob_path(@project.namespace, @project, @id),
method: :put
...@@ -9,10 +9,6 @@ Gitlab::Application.routes.draw do ...@@ -9,10 +9,6 @@ Gitlab::Application.routes.draw do
resource :lint, only: [:show, :create] resource :lint, only: [:show, :create]
resource :help do
get :oauth2
end
resources :projects do resources :projects do
collection do collection do
post :add post :add
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150916000405) do ActiveRecord::Schema.define(version: 20150916145038) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
......
...@@ -52,7 +52,14 @@ This also breaks your database structure disallowing you to use it anymore. ...@@ -52,7 +52,14 @@ This also breaks your database structure disallowing you to use it anymore.
ALTER TABLE web_hooks RENAME TO ci_web_hooks; ALTER TABLE web_hooks RENAME TO ci_web_hooks;
EOF EOF
### 4. Dump GitLab CI database [CI] ### 4. Remove CI cronjob
```
cd /home/gitlab_ci/gitlab-ci
sudo -u gitlab_ci -H bundle exec whenever --clear-crontab
```
### 5. Dump GitLab CI database [CI]
First check used database and credentials on GitLab CI and GitLab CE/EE: First check used database and credentials on GitLab CI and GitLab CE/EE:
...@@ -125,18 +132,18 @@ You will need to put these credentials into commands executed below.** ...@@ -125,18 +132,18 @@ You will need to put these credentials into commands executed below.**
# Filter to only include INSERT statements # Filter to only include INSERT statements
grep "^\(START\|SET\|INSERT\|COMMIT\)" gitlab_ci.sql.tmp2 > gitlab_ci.sql grep "^\(START\|SET\|INSERT\|COMMIT\)" gitlab_ci.sql.tmp2 > gitlab_ci.sql
### 5. Make sure that your GitLab CE/EE is 8.0 [CE] ### 6. Make sure that your GitLab CE/EE is 8.0 [CE]
Please verify that you use GitLab CE/EE 8.0. Please verify that you use GitLab CE/EE 8.0.
If not, please follow the update guide: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/7.14-to-8.0.md If not, please follow the update guide: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/7.14-to-8.0.md
### 6. Stop GitLab CE/EE [CE] ### 7. Stop GitLab CE/EE [CE]
Before you can migrate data you need to stop GitLab CE/EE first. Before you can migrate data you need to stop GitLab CE/EE first.
sudo service gitlab stop sudo service gitlab stop
### 7. Backup GitLab CE/EE [CE] ### 8. Backup GitLab CE/EE [CE]
This migration poses a **significant risk** of breaking your GitLab CE/EE. This migration poses a **significant risk** of breaking your GitLab CE/EE.
**You should create the GitLab CI/EE backup before doing it.** **You should create the GitLab CI/EE backup before doing it.**
...@@ -144,7 +151,7 @@ This migration poses a **significant risk** of breaking your GitLab CE/EE. ...@@ -144,7 +151,7 @@ This migration poses a **significant risk** of breaking your GitLab CE/EE.
cd /home/git/gitlab cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
### 8. Copy secret tokens [CE] ### 9. Copy secret tokens [CE]
The `secrets.yml` file stores encryption keys for secure variables. The `secrets.yml` file stores encryption keys for secure variables.
...@@ -154,7 +161,7 @@ You need to copy the content of `config/secrets.yml` to the same file in GitLab ...@@ -154,7 +161,7 @@ You need to copy the content of `config/secrets.yml` to the same file in GitLab
sudo chown git:git /home/git/gitlab/config/secrets.yml sudo chown git:git /home/git/gitlab/config/secrets.yml
sudo chown 0600 /home/git/gitlab/config/secrets.yml sudo chown 0600 /home/git/gitlab/config/secrets.yml
### 9. New configuration options for `gitlab.yml` [CE] ### 10. New configuration options for `gitlab.yml` [CE]
There are new configuration options available for [`gitlab.yml`](config/gitlab.yml.example). There are new configuration options available for [`gitlab.yml`](config/gitlab.yml.example).
View them with the command below and apply them manually to your current `gitlab.yml`: View them with the command below and apply them manually to your current `gitlab.yml`:
...@@ -165,7 +172,7 @@ git diff origin/7-14-stable:config/gitlab.yml.example origin/8-0-stable:config/g ...@@ -165,7 +172,7 @@ git diff origin/7-14-stable:config/gitlab.yml.example origin/8-0-stable:config/g
The new options include configuration of GitLab CI that are now being part of GitLab CE and EE. The new options include configuration of GitLab CI that are now being part of GitLab CE and EE.
### 10. Copy build logs [CE] ### 11. Copy build logs [CE]
You need to copy the contents of `builds/` to the same directory in GitLab CE/EE. You need to copy the contents of `builds/` to the same directory in GitLab CE/EE.
...@@ -174,7 +181,7 @@ You need to copy the contents of `builds/` to the same directory in GitLab CE/EE ...@@ -174,7 +181,7 @@ You need to copy the contents of `builds/` to the same directory in GitLab CE/EE
The build traces are usually quite big so it will take a significant amount of time. The build traces are usually quite big so it will take a significant amount of time.
### 11. Import GitLab CI database [CE] ### 12. Import GitLab CI database [CE]
The one of the last steps is to import existing GitLab CI database. The one of the last steps is to import existing GitLab CI database.
...@@ -189,13 +196,13 @@ The task does: ...@@ -189,13 +196,13 @@ The task does:
1. Fix tags assigned to Builds and Runners 1. Fix tags assigned to Builds and Runners
1. Fix services used by CI 1. Fix services used by CI
### 12. Start GitLab [CE] ### 13. Start GitLab [CE]
You can start GitLab CI/EE now and see if everything is working. You can start GitLab CI/EE now and see if everything is working.
sudo service gitlab start sudo service gitlab start
### 13. Update nginx [CI] ### 14. Update nginx [CI]
Now get back to GitLab CI and update **Nginx** configuration in order to: Now get back to GitLab CI and update **Nginx** configuration in order to:
1. Have all existing runners able to communicate with a migrated GitLab CI. 1. Have all existing runners able to communicate with a migrated GitLab CI.
...@@ -263,7 +270,7 @@ You should also make sure that you can do: ...@@ -263,7 +270,7 @@ You should also make sure that you can do:
sudo /etc/init.d/nginx restart sudo /etc/init.d/nginx restart
### 14. Done! ### 15. Done!
If everything went OK you should be able to access all your GitLab CI data by pointing your browser to: If everything went OK you should be able to access all your GitLab CI data by pointing your browser to:
https://gitlab.example.com/ci/. https://gitlab.example.com/ci/.
......
...@@ -121,6 +121,12 @@ X-Gitlab-Event: Issue Hook ...@@ -121,6 +121,12 @@ X-Gitlab-Event: Issue Hook
"username": "root", "username": "root",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
}, },
"repository": {
"name": "Gitlab Test",
"url": "http://example.com/gitlabhq/gitlab-test.git",
"description": "Aut reprehenderit ut est.",
"homepage": "http://example.com/gitlabhq/gitlab-test"
},
"object_attributes": { "object_attributes": {
"id": 301, "id": 301,
"title": "New API: create/update/delete file", "title": "New API: create/update/delete file",
......
...@@ -2,6 +2,7 @@ require 'spec_helper' ...@@ -2,6 +2,7 @@ require 'spec_helper'
describe Issue, "Issuable" do describe Issue, "Issuable" do
let(:issue) { create(:issue) } let(:issue) { create(:issue) }
let(:user) { create(:user) }
describe "Associations" do describe "Associations" do
it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:project) }
...@@ -66,4 +67,19 @@ describe Issue, "Issuable" do ...@@ -66,4 +67,19 @@ describe Issue, "Issuable" do
expect(issue.new?).to be_falsey expect(issue.new?).to be_falsey
end end
end end
describe "#to_hook_data" do
let(:hook_data) { issue.to_hook_data(user) }
it "returns correct hook data" do
expect(hook_data[:object_kind]).to eq("issue")
expect(hook_data[:user]).to eq(user.hook_attrs)
expect(hook_data[:repository][:name]).to eq(issue.project.name)
expect(hook_data[:repository][:url]).to eq(issue.project.url_to_repo)
expect(hook_data[:repository][:description]).to eq(issue.project.description)
expect(hook_data[:repository][:homepage]).to eq(issue.project.web_url)
expect(hook_data[:object_attributes]).to eq(issue.hook_attrs)
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment