Commit ecd301dd authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce

parents 488a7f59 5fea640e
......@@ -8,6 +8,7 @@ v 8.10.0 (unreleased)
- Refactor repository paths handling to allow multiple git mount points
- Optimize system note visibility checking by memoizing the visible reference count !5070
- Add Application Setting to configure default Repository Path for new projects
- Delete award emoji when deleting a user
- Remove pinTo from Flash and make inline flash messages look nicer !4854 (winniehell)
- Wrap code blocks on Activies and Todos page. !4783 (winniehell)
- Align flash messages with left side of page content !4959 (winniehell)
......@@ -34,6 +35,7 @@ v 8.10.0 (unreleased)
- Fix changing issue state columns in milestone view
- Update health_check gem to version 2.1.0
- Add notification settings dropdown for groups
- Render inline diffs for multiple changed lines following eachother
- Wildcards for protected branches. !4665
- Allow importing from Github using Personal Access Tokens. (Eric K Idema)
- API: Todos !3188 (Robert Schilling)
......@@ -83,12 +85,18 @@ v 8.10.0 (unreleased)
- Style of import project buttons were fixed in the new project page. !5183 (rdemirbay)
- Fix GitHub client requests when rate limit is disabled
- Optimistic locking for Issues and Merge Requests (Title and description overriding prevention)
- Redesign Builds and Pipelines pages
- Change status color and icon for running builds
v 8.9.6
- Fix importing of events under notes for GitLab projects. !5154
- Fix log statements in import/export. !5129
- Fix commit avatar alignment in compare view. !5128
- Fix broken migration in MySQL. !5005
- Overwrite Host and X-Forwarded-Host headers in NGINX !5213
v 8.9.6 (unreleased)
- Fix importing of events under notes for GitLab projects
v 8.9.5
- Add more debug info to import/export and memory killer. !5108
......
......@@ -20,6 +20,7 @@
}
&.s16 { width: 16px; height: 16px; margin-right: 6px; }
&.s20 { width: 20px; height: 20px; margin-right: 7px; }
&.s24 { width: 24px; height: 24px; margin-right: 8px; }
&.s26 { width: 26px; height: 26px; margin-right: 8px; }
&.s32 { width: 32px; height: 32px; margin-right: 10px; }
......
......@@ -17,6 +17,7 @@ $focus-border-color: #3aabf0;
$table-border-color: #f0f0f0;
$background-color: #fafafa;
$dark-background-color: #f7f7f7;
$table-text-gray: #8f8f8f;
/*
* Text
......
......@@ -83,14 +83,6 @@
}
}
table.builds {
.build-link {
a {
color: $gl-dark-link-color;
}
}
}
.build-trace {
background: $ci-output-bg;
color: $ci-text-color;
......
......@@ -162,9 +162,15 @@
}
.filtered-labels {
font-size: 0;
padding: 12px 16px;
.label-row {
margin-top: 4px;
margin-bottom: 4px;
&:not(:last-child) {
margin-right: 5px;
margin-right: 8px;
}
}
......
......@@ -73,11 +73,14 @@
color: #888;
}
&.ci-pending,
&.ci-running {
&.ci-pending {
color: $gl-warning;
}
&.ci-running {
color: $blue-normal;
}
&.ci-failed,
&.ci-error {
color: $gl-danger;
......
.pipelines {
.stage {
max-width: 100px;
max-width: 80px;
width: 80px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.duration, .finished_at {
margin: 4px 0;
}
.commit-title {
margin: 0;
}
......@@ -22,3 +19,136 @@
margin: 4px;
}
}
.content-list {
&.pipelines,
&.builds-content-list {
width: 100%;
overflow: auto;
}
}
.table.builds {
min-width: 1100px;
tr {
th {
padding: 16px;
border: none;
}
}
tbody {
border-top-width: 1px;
}
.branch-commit {
.branch-name {
margin-left: 8px;
font-weight: bold;
max-width: 180px;
overflow: hidden;
display: inline-block;
white-space: nowrap;
vertical-align: top;
text-overflow: ellipsis;
}
svg {
margin: 0 6px;
height: 14px;
width: auto;
vertical-align: middle;
}
.commit-id {
color: $gl-link-color;
margin-right: 8px;
}
.commit-title {
margin-top: 4px;
max-width: 320px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.avatar {
margin-left: 0;
}
.label-container {
.label {
margin-top: 5px;
}
}
}
.duration,
.finished-at {
color: $table-text-gray;
margin: 4px 0;
.fa {
font-size: 12px;
}
svg {
height: 12px;
width: auto;
vertical-align: middle;
}
.fa,
svg {
margin-right: 5px;
}
}
.pipeline-actions {
.btn {
margin: 0;
color: $table-text-gray;
}
.dropdown-toggle,
.dropdown-menu {
color: $table-text-gray;
.fa {
color: $table-text-gray;
margin-right: 6px;
font-size: 14px;
}
}
.btn-remove {
color: $white-light;
}
.btn-group {
&.open {
.btn-default {
background-color: $white-normal;
border-color: $border-white-normal;
}
}
}
}
.build-link {
a {
color: $gl-dark-link-color;
}
}
.btn-group.open .dropdown-toggle {
box-shadow: none;
}
}
......@@ -32,11 +32,15 @@
border-color: $gl-gray;
}
&.ci-pending,
&.ci-running {
&.ci-pending {
color: $gl-warning;
border-color: $gl-warning;
}
&.ci-running {
color: $blue-normal;
border-color: $blue-normal;
}
}
.ci-status-icon-success {
......@@ -45,10 +49,12 @@
.ci-status-icon-failed {
color: $gl-danger;
}
.ci-status-icon-running,
.ci-status-icon-pending {
color: $gl-warning;
}
.ci-status-icon-running {
color: $blue-normal;
}
.ci-status-icon-canceled,
.ci-status-icon-disabled,
.ci-status-icon-not-found,
......
......@@ -31,7 +31,7 @@ module AppearancesHelper
end
end
def navbar_icon(icon_name, size: 16)
def custom_icon(icon_name, size: 16)
render "shared/icons/#{icon_name}.svg", size: size
end
end
......@@ -29,8 +29,10 @@ module CiStatusHelper
'check'
when 'failed'
'close'
when 'running', 'pending'
when 'pending'
'clock-o'
when 'running'
'spinner'
else
'circle'
end
......
......@@ -87,7 +87,7 @@ class User < ActiveRecord::Base
has_many :builds, dependent: :nullify, class_name: 'Ci::Build'
has_many :todos, dependent: :destroy
has_many :notification_settings, dependent: :destroy
has_many :award_emoji, as: :awardable, dependent: :destroy
has_many :award_emoji, dependent: :destroy
#
# Validations
......
- project = build.project
%tr.build
%tr.build.commit
%td.status
= ci_status_with_icon(build.status)
%td.build-link
%td
.branch-commit
- if can?(current_user, :read_build, build.project)
= link_to namespace_project_build_url(build.project.namespace, build.project, build) do
%strong Build ##{build.id}
%span.build-link ##{build.id}
- else
%strong Build ##{build.id}
%span.build-link ##{build.id}
- if build.stuck?
%i.fa.fa-warning.text-warning
%td
- if project
= link_to project.name_with_namespace, admin_namespace_project_path(project.namespace, project)
%td
= link_to build.short_sha, namespace_project_commit_path(build.project.namespace, build.project, build.sha), class: "monospace"
%td
- if build.ref
= link_to build.ref, namespace_project_commits_path(build.project.namespace, build.project, build.ref)
= link_to build.ref, namespace_project_commits_path(build.project.namespace, build.project, build.ref), class: "monospace branch-name"
- else
.light none
= custom_icon("icon_commit")
%td
- if build.try(:runner)
= runner_link(build.runner)
- else
.light none
%td
#{build.stage} / #{build.name}
= link_to build.short_sha, namespace_project_commit_path(build.project.namespace, build.project, build.sha), class: "monospace commit-id"
%td
.label-container
- if build.tags.any?
- build.tags.each do |tag|
%span.label.label-primary
......@@ -45,12 +32,28 @@
- if build.try(:allow_failure)
%span.label.label-danger allowed to fail
%td.duration
%td
- if project
= link_to project.name_with_namespace, admin_namespace_project_path(project.namespace, project)
%td
- if build.try(:runner)
= runner_link(build.runner)
- else
.light none
%td
#{build.stage} / #{build.name}
%td
- if build.duration
#{duration_in_words(build.finished_at, build.started_at)}
%p.duration
= custom_icon("icon_timer")
= duration_in_numbers(build.finished_at, build.started_at)
%td.timestamp
- if build.finished_at
%p.finished-at
= icon("calendar")
%span #{time_ago_with_tooltip(build.finished_at)}
- if defined?(coverage) && coverage
......
......@@ -27,7 +27,7 @@
.row-content-block.second-block
#{(@scope || 'all').capitalize} builds
%ul.content-list
%ul.content-list.builds-content-list
- if @builds.blank?
%li
.nothing-here-block No builds to show
......@@ -37,15 +37,11 @@
%thead
%tr
%th Status
%th Build ID
%th Project
%th Commit
%th Ref
%th Project
%th Runner
%th Name
%th Tags
%th Duration
%th Finished at
%th
%th
- @builds.each do |build|
......
......@@ -9,14 +9,14 @@
%span
To do
%span.badge
= todos_pending_count
= number_with_delimiter(todos_pending_count)
- todo_done_active = ('active' if params[:state] == 'done')
%li{class: "todos-done #{todo_done_active}"}
= link_to todos_filter_path(state: 'done') do
%span
Done
%span.badge
= todos_done_count
= number_with_delimiter(todos_done_count)
.nav-controls
- if @todos.any?(&:pending?)
......
......@@ -36,7 +36,7 @@
= link_to ci_lint_path, class: 'btn btn-default' do
%span CI Lint
%ul.content-list
%ul.content-list.builds-content-list
- if @builds.blank?
%li
.nothing-here-block No builds to show
......@@ -46,14 +46,10 @@
%thead
%tr
%th Status
%th Build ID
%th Commit
%th Ref
%th Stage
%th Name
%th Tags
%th Duration
%th Finished at
%th
- if @project.build_coverage_enabled?
%th Coverage
%th
......
%tr.build
%tr.build.commit
%td.status
- if can?(current_user, :read_build, build)
= ci_status_with_icon(build.status, namespace_project_build_url(build.project.namespace, build.project, build))
- else
= ci_status_with_icon(build.status)
%td.build-link
%td
.branch-commit
- if can?(current_user, :read_build, build)
= link_to namespace_project_build_url(build.project.namespace, build.project, build) do
%strong ##{build.id}
%span ##{build.id}
- else
%strong ##{build.id}
%span ##{build.id}
- if build.stuck?
= icon('warning', class: 'text-warning has-tooltip', title: 'Build is stuck. Check runners.')
- if defined?(retried) && retried
= icon('warning', class: 'text-warning has-tooltip', title: 'Build was retried.')
- if defined?(commit_sha) && commit_sha
%td
= link_to build.short_sha, namespace_project_commit_path(build.project.namespace, build.project, build.sha), class: "monospace"
- if defined?(ref) && ref
%td
- if build.ref
= link_to build.ref, namespace_project_commits_path(build.project.namespace, build.project, build.ref)
= link_to build.ref, namespace_project_commits_path(build.project.namespace, build.project, build.ref), class: "monospace branch-name"
- else
.light none
= custom_icon("icon_commit")
- if defined?(commit_sha) && commit_sha
= link_to build.short_sha, namespace_project_commit_path(build.project.namespace, build.project, build.sha), class: "commit-id monospace"
.label-container
- if build.tags.any?
- build.tags.each do |tag|
%span.label.label-primary
= tag
- if build.try(:trigger_request)
%span.label.label-info triggered
- if build.try(:allow_failure)
%span.label.label-danger allowed to fail
- if defined?(retried) && retried
%span.label.label-warning retried
- if defined?(runner) && runner
%td
......@@ -43,24 +56,13 @@
= build.name
%td
.label-container
- if build.tags.any?
- build.tags.each do |tag|
%span.label.label-primary
= tag
- if build.try(:trigger_request)
%span.label.label-info triggered
- if build.try(:allow_failure)
%span.label.label-danger allowed to fail
- if defined?(retried) && retried
%span.label.label-warning retried
%td.duration
- if build.duration
#{duration_in_words(build.finished_at, build.started_at)}
%td.timestamp
%p.duration
= custom_icon("icon_timer")
= duration_in_numbers(build.finished_at, build.started_at)
- if build.finished_at
%p.finished-at
= icon("calendar")
%span #{time_ago_with_tooltip(build.finished_at)}
- if defined?(coverage) && coverage
......@@ -79,4 +81,4 @@
= icon('remove', class: 'cred')
- elsif defined?(allow_retry) && allow_retry && build.retryable?
= link_to retry_namespace_project_build_path(build.project.namespace, build.project, build, return_to: request.original_url), method: :post, title: 'Retry', class: 'btn btn-build' do
= icon('refresh')
= icon('repeat')
- status = pipeline.status
%tr.commit
%td.commit-link
= link_to namespace_project_pipeline_path(@project.namespace, @project, pipeline.id), class: "ci-status ci-#{status}" do
= ci_icon_for_status(status)
%strong ##{pipeline.id}
= link_to namespace_project_pipeline_path(@project.namespace, @project, pipeline.id) do
= ci_status_with_icon(status)
%td
%div.branch-commit
.branch-commit
= link_to namespace_project_pipeline_path(@project.namespace, @project, pipeline.id) do
%span ##{pipeline.id}
- if pipeline.ref
= link_to pipeline.ref, namespace_project_commits_path(@project.namespace, @project, pipeline.ref), class: "monospace"
&middot;
= link_to pipeline.ref, namespace_project_commits_path(@project.namespace, @project, pipeline.ref), class: "monospace branch-name"
= custom_icon("icon_commit")
= link_to pipeline.short_sha, namespace_project_commit_path(@project.namespace, @project, pipeline.sha), class: "commit-id monospace"
&nbsp;
- if pipeline.tag?
%span.label.label-primary tag
- elsif pipeline.latest?
......@@ -25,6 +26,7 @@
%p.commit-title
- if commit = pipeline.commit
= commit_author_avatar(commit, size: 20)
= link_to_gfm truncate(commit.title, length: 60), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "commit-row-message"
- else
Cant find HEAD commit for this branch
......@@ -45,15 +47,30 @@
%td
- if pipeline.started_at && pipeline.finished_at
%p.duration
= custom_icon("icon_timer")
= duration_in_numbers(pipeline.finished_at, pipeline.started_at)
- if pipeline.finished_at
%p.finished-at
= icon("calendar")
#{time_ago_with_tooltip(pipeline.finished_at)}
%td
%td.pipeline-actions
.controls.hidden-xs.pull-right
- artifacts = pipeline.builds.latest.select { |b| b.artifacts? }
- if artifacts.present?
.dropdown.inline.build-artifacts
%button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
= icon('download')
.btn-group.inline
.btn-group
%a.dropdown-toggle.btn.btn-default{type: 'button', 'data-toggle' => 'dropdown'}
= icon("play")
%b.caret
%ul.dropdown-menu.dropdown-menu-align-right
%li
= link_to '#' do
= icon("play")
%span Deploy to production
.btn-group
%a.dropdown-toggle.btn.btn-default.build-artifacts{type: 'button', 'data-toggle' => 'dropdown'}
= icon("download")
%b.caret
%ul.dropdown-menu.dropdown-menu-align-right
- artifacts.each do |build|
......
......@@ -42,9 +42,7 @@
%th Status
%th Build ID
%th Name
%th Tags
%th Duration
%th Finished at
%th
- if pipeline.project.build_coverage_enabled?
%th Coverage
%th
......
......@@ -50,10 +50,12 @@
%td.duration
- if generic_commit_status.duration
= icon("clock-o")
#{duration_in_words(generic_commit_status.finished_at, generic_commit_status.started_at)}
%td.timestamp
- if generic_commit_status.finished_at
= icon("calendar")
%span #{time_ago_with_tooltip(generic_commit_status.finished_at)}
- if defined?(coverage) && coverage
......
......@@ -32,7 +32,7 @@
Code, test, and deploy together
.blank-state
.blank-state-icon
= navbar_icon("issues", size: 50)
= custom_icon("issues", size: 50)
%h3.blank-state-title
You don't have any issues right now.
%p.blank-state-text
......
......@@ -28,7 +28,7 @@
.nav-controls
- if can? current_user, :create_pipeline, @project
= link_to new_namespace_project_pipeline_path(@project.namespace, @project), class: 'btn btn-create' do
New pipeline
Run pipeline
- unless @repository.gitlab_ci_yml
= link_to 'Get started with Pipelines', help_page_path('ci/quick_start/README'), class: 'btn btn-info'
......@@ -45,13 +45,13 @@
.table-holder
%table.table.builds
%tbody
%th ID
%th Status
%th Commit
- stages.each do |stage|
%th.stage
%span.has-tooltip{ title: "#{stage.titleize}" }
= stage.titleize
%th Duration
%th
%th
= render @pipelines, commit_sha: true, stage: true, allow_retry: true, stages: stages
......
- page_title "Snippets"
.row-content-block.top-block
.sub-header-block
.pull-right
- if can?(current_user, :create_project_snippet, @project)
= link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new", title: "New Snippet" do
......
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40">
<path fill="#8F8F8F" fill-rule="evenodd" d="M28.7769836,18 C27.8675252,13.9920226 24.2831748,11 20,11 C15.7168252,11 12.1324748,13.9920226 11.2230164,18 L4.0085302,18 C2.90195036,18 2,18.8954305 2,20 C2,21.1122704 2.8992496,22 4.0085302,22 L11.2230164,22 C12.1324748,26.0079774 15.7168252,29 20,29 C24.2831748,29 27.8675252,26.0079774 28.7769836,22 L35.9914698,22 C37.0980496,22 38,21.1045695 38,20 C38,18.8877296 37.1007504,18 35.9914698,18 L28.7769836,18 L28.7769836,18 Z M20,25 C22.7614237,25 25,22.7614237 25,20 C25,17.2385763 22.7614237,15 20,15 C17.2385763,15 15,17.2385763 15,20 C15,22.7614237 17.2385763,25 20,25 L20,25 Z"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><g fill="#8F8F8F" fill-rule="evenodd"><path d="M29.513 10.134A15.922 15.922 0 0 0 23 7.28V6h2.993C26.55 6 27 5.552 27 5V2a1 1 0 0 0-1.007-1H14.007C13.45 1 13 1.448 13 2v3a1 1 0 0 0 1.007 1H17v1.28C9.597 8.686 4 15.19 4 23c0 8.837 7.163 16 16 16s16-7.163 16-16c0-3.461-1.099-6.665-2.967-9.283l1.327-1.58a2.498 2.498 0 0 0-.303-3.53 2.499 2.499 0 0 0-3.528.315l-1.016 1.212zM20 34c6.075 0 11-4.925 11-11s-4.925-11-11-11S9 16.925 9 23s4.925 11 11 11z"/><path d="M19 21h-4.002c-.552 0-.998.452-.998 1.01v1.98c0 .567.447 1.01.998 1.01h7.004c.274 0 .521-.111.701-.291a.979.979 0 0 0 .297-.704v-8.01c0-.54-.452-.995-1.01-.995h-1.98a.997.997 0 0 0-1.01.995V21z"/></g></svg>
\ No newline at end of file
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class RemoveAwardEmojisWithNoUser < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
# existing transaction. When using "add_concurrent_index" make sure that this
# method is the _only_ method called in the migration, any other changes
# should go in a separate migration. This ensures that upon failure _only_ the
# index creation fails and can be retried or reverted easily.
#
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def up
AwardEmoji.joins('LEFT JOIN users ON users.id = user_id').where('users.id IS NULL').destroy_all
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160707104333) do
ActiveRecord::Schema.define(version: 20160712171823) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......
module Gitlab
module Diff
class InlineDiff
# Regex to find a run of deleted lines followed by the same number of added lines
LINE_PAIRS_PATTERN = %r{
# Runs start at the beginning of the string (the first line) or after a space (for an unchanged line)
(?:\A|\s)
# This matches a number of `-`s followed by the same number of `+`s through recursion
(?<del_ins>
-
\g<del_ins>?
\+
)
# Runs end at the end of the string (the last line) or before a space (for an unchanged line)
(?=\s|\z)
}x.freeze
attr_accessor :old_line, :new_line, :offset
def self.for_lines(lines)
local_edit_indexes = self.find_local_edits(lines)
changed_line_pairs = self.find_changed_line_pairs(lines)
inline_diffs = []
local_edit_indexes.each do |index|
old_index = index
new_index = index + 1
changed_line_pairs.each do |old_index, new_index|
old_line = lines[old_index]
new_line = lines[new_index]
......@@ -51,18 +65,28 @@ module Gitlab
private
def self.find_local_edits(lines)
line_prefixes = lines.map { |line| line.match(/\A([+-])/) ? $1 : ' ' }
joined_line_prefixes = " #{line_prefixes.join} "
# Finds pairs of old/new line pairs that represent the same line that changed
def self.find_changed_line_pairs(lines)
# Prefixes of all diff lines, indicating their types
# For example: `" - + -+ ---+++ --+ -++"`
line_prefixes = lines.each_with_object("") { |line, s| s << line[0] }.gsub(/[^ +-]/, ' ')
changed_line_pairs = []
line_prefixes.scan(LINE_PAIRS_PATTERN) do
# For `"---+++"`, `begin_index == 0`, `end_index == 6`
begin_index, end_index = Regexp.last_match.offset(:del_ins)
offset = 0
local_edit_indexes = []
while index = joined_line_prefixes.index(" -+ ", offset)
local_edit_indexes << index
offset = index + 1
# For `"---+++"`, `changed_line_count == 3`
changed_line_count = (end_index - begin_index) / 2
halfway_index = begin_index + changed_line_count
(begin_index...halfway_index).each do |i|
# For `"---+++"`, index 1 maps to 1 + 3 = 4
changed_line_pairs << [i, i + changed_line_count]
end
end
local_edit_indexes
changed_line_pairs
end
def longest_common_prefix(a, b)
......
......@@ -49,7 +49,12 @@ server {
proxy_http_version 1.1;
proxy_set_header Host $http_host;
## By overwriting Host and clearing X-Forwarded-Host we ensure that
## internal HTTP redirects generated by GitLab always send users to
## YOUR_SERVER_FQDN.
proxy_set_header Host YOUR_SERVER_FQDN;
proxy_set_header X-Forwarded-Host "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
......
......@@ -93,7 +93,12 @@ server {
proxy_http_version 1.1;
proxy_set_header Host $http_host;
## By overwriting Host and clearing X-Forwarded-Host we ensure that
## internal HTTP redirects generated by GitLab always send users to
## YOUR_SERVER_FQDN.
proxy_set_header Host YOUR_SERVER_FQDN;
proxy_set_header X-Forwarded-Host "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
......
......@@ -11,7 +11,7 @@ describe NotesFinder do
project.team << [user, :master]
end
describe :execute do
describe '#execute' do
let(:params) { { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago.to_i } }
before do
......
......@@ -31,7 +31,7 @@ module Ci
})
end
describe :only do
describe 'only' do
it "does not return builds if only has another branch" do
config = YAML.dump({
before_script: ["pwd"],
......@@ -187,7 +187,7 @@ module Ci
end
end
describe :except do
describe 'except' do
it "returns builds if except has another branch" do
config = YAML.dump({
before_script: ["pwd"],
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe 'Gitlab::BuildDataBuilder' do
let(:build) { create(:ci_build) }
describe :build do
describe '.build' do
let(:data) do
Gitlab::BuildDataBuilder.build(build)
end
......
......@@ -8,14 +8,14 @@ describe Gitlab::Diff::File, lib: true do
let(:diff) { commit.diffs.first }
let(:diff_file) { Gitlab::Diff::File.new(diff, diff_refs: commit.diff_refs, repository: project.repository) }
describe :diff_lines do
describe '#diff_lines' do
let(:diff_lines) { diff_file.diff_lines }
it { expect(diff_lines.size).to eq(30) }
it { expect(diff_lines.first).to be_kind_of(Gitlab::Diff::Line) }
end
describe :mode_changed? do
describe '#mode_changed?' do
it { expect(diff_file.mode_changed?).to be_falsey }
end
......
......@@ -3,14 +3,19 @@ require 'spec_helper'
describe Gitlab::Diff::InlineDiff, lib: true do
describe '.for_lines' do
let(:diff) do
<<eos
<<-EOF.strip_heredoc
class Test
- def initialize(test = true)
+ def initialize(test = false)
- def initialize(test = true)
+ def initialize(test = false)
@test = test
- if true
- @foo = "bar"
+ unless false
+ @foo = "baz"
end
end
eos
end
EOF
end
let(:subject) { described_class.for_lines(diff.lines) }
......@@ -20,8 +25,11 @@ eos
expect(subject[1]).to eq([25..27])
expect(subject[2]).to eq([25..28])
expect(subject[3]).to be_nil
expect(subject[4]).to be_nil
expect(subject[5]).to be_nil
expect(subject[4]).to eq([5..10])
expect(subject[5]).to eq([17..17])
expect(subject[6]).to eq([5..15])
expect(subject[7]).to eq([17..17])
expect(subject[8]).to be_nil
end
end
......
......@@ -8,7 +8,7 @@ describe Gitlab::Diff::Parser, lib: true do
let(:diff) { commit.diffs.first }
let(:parser) { Gitlab::Diff::Parser.new }
describe :parse do
describe '#parse' do
let(:diff) do
<<eos
--- a/files/ruby/popen.rb
......
......@@ -4,7 +4,7 @@ describe Gitlab::LDAP::Access, lib: true do
let(:access) { Gitlab::LDAP::Access.new user }
let(:user) { create(:omniauth_user) }
describe :allowed? do
describe '#allowed?' do
subject { access.allowed? }
context 'when the user cannot be found' do
......
......@@ -25,7 +25,7 @@ describe Gitlab::LDAP::User, lib: true do
OmniAuth::AuthHash.new(uid: 'my-uid', provider: 'ldapmain', info: info_upper_case)
end
describe :changed? do
describe '#changed?' do
it "marks existing ldap user as changed" do
create(:omniauth_user, extern_uid: 'my-uid', provider: 'ldapmain')
expect(ldap_user.changed?).to be_truthy
......
......@@ -15,7 +15,7 @@ describe Ci::Pipeline, models: true do
it { is_expected.to respond_to :git_author_email }
it { is_expected.to respond_to :short_sha }
describe :valid_commit_sha do
describe '#valid_commit_sha' do
context 'commit.sha can not start with 00000000' do
before do
pipeline.sha = '0' * 40
......@@ -26,7 +26,7 @@ describe Ci::Pipeline, models: true do
end
end
describe :short_sha do
describe '#short_sha' do
subject { pipeline.short_sha }
it 'has 8 items' do
......@@ -35,10 +35,10 @@ describe Ci::Pipeline, models: true do
it { expect(pipeline.sha).to start_with(subject) }
end
describe :create_next_builds do
describe '#create_next_builds' do
end
describe :retried do
describe '#retried' do
subject { pipeline.retried }
before do
......@@ -51,7 +51,7 @@ describe Ci::Pipeline, models: true do
end
end
describe :create_builds do
describe '#create_builds' do
let!(:pipeline) { FactoryGirl.create :ci_pipeline, project: project, ref: 'master', tag: false }
def create_builds(trigger_request = nil)
......
......@@ -9,7 +9,7 @@ describe Ci::Variable, models: true do
subject.value = secret_value
end
describe :value do
describe '#value' do
it 'stores the encrypted value' do
expect(subject.encrypted_value).not_to be_nil
end
......
......@@ -24,14 +24,14 @@ describe CommitStatus, models: true do
it { is_expected.to respond_to :running? }
it { is_expected.to respond_to :pending? }
describe :author do
describe '#author' do
subject { commit_status.author }
before { commit_status.author = User.new }
it { is_expected.to eq(commit_status.user) }
end
describe :started? do
describe '#started?' do
subject { commit_status.started? }
context 'without started_at' do
......@@ -57,7 +57,7 @@ describe CommitStatus, models: true do
end
end
describe :active? do
describe '#active?' do
subject { commit_status.active? }
%w(pending running).each do |state|
......@@ -77,7 +77,7 @@ describe CommitStatus, models: true do
end
end
describe :complete? do
describe '#complete?' do
subject { commit_status.complete? }
%w(success failed canceled).each do |state|
......@@ -97,7 +97,7 @@ describe CommitStatus, models: true do
end
end
describe :duration do
describe '#duration' do
subject { commit_status.duration }
it { is_expected.to eq(120.0) }
......@@ -122,7 +122,7 @@ describe CommitStatus, models: true do
end
end
describe :latest do
describe '.latest' do
subject { CommitStatus.latest.order(:id) }
before do
......@@ -138,7 +138,7 @@ describe CommitStatus, models: true do
end
end
describe :running_or_pending do
describe '.running_or_pending' do
subject { CommitStatus.running_or_pending.order(:id) }
before do
......
......@@ -7,7 +7,7 @@ describe Mentionable do
nil
end
describe :references do
describe 'references' do
let(:project) { create(:project) }
it 'excludes JIRA references' do
......
......@@ -18,7 +18,7 @@ describe ForkedProjectLink, "add link on fork" do
end
end
describe :forked_from_project do
describe '#forked?' do
let(:forked_project_link) { build(:forked_project_link) }
let(:project_from) { create(:project) }
let(:project_to) { create(:project, forked_project_link: forked_project_link) }
......
......@@ -4,33 +4,33 @@ describe GenericCommitStatus, models: true do
let(:pipeline) { FactoryGirl.create :ci_pipeline }
let(:generic_commit_status) { FactoryGirl.create :generic_commit_status, pipeline: pipeline }
describe :context do
describe '#context' do
subject { generic_commit_status.context }
before { generic_commit_status.context = 'my_context' }
it { is_expected.to eq(generic_commit_status.name) }
end
describe :tags do
describe '#tags' do
subject { generic_commit_status.tags }
it { is_expected.to eq([:external]) }
end
describe :set_default_values do
describe 'set_default_values' do
before do
generic_commit_status.context = nil
generic_commit_status.stage = nil
generic_commit_status.save
end
describe :context do
describe '#context' do
subject { generic_commit_status.context }
it { is_expected.not_to be_nil }
end
describe :stage do
describe '#stage' do
subject { generic_commit_status.stage }
it { is_expected.not_to be_nil }
......
......@@ -14,7 +14,7 @@ describe GlobalMilestone, models: true do
let(:milestone2_project2) { create(:milestone, title: "VD-123", project: project2) }
let(:milestone2_project3) { create(:milestone, title: "VD-123", project: project3) }
describe :build_collection do
describe '.build_collection' do
before do
milestones =
[
......@@ -42,7 +42,7 @@ describe GlobalMilestone, models: true do
end
end
describe :initialize do
describe '#initialize' do
before do
milestones =
[
......@@ -63,7 +63,7 @@ describe GlobalMilestone, models: true do
end
end
describe :safe_title do
describe '#safe_title' do
let(:milestone) { create(:milestone, title: "git / test", project: project1) }
it 'should strip out slashes and spaces' do
......
......@@ -97,22 +97,22 @@ describe Group, models: true do
end
end
describe :users do
describe '#users' do
it { expect(group.users).to eq(group.owners) }
end
describe :human_name do
describe '#human_name' do
it { expect(group.human_name).to eq(group.name) }
end
describe :add_users do
describe '#add_user' do
let(:user) { create(:user) }
before { group.add_user(user, GroupMember::MASTER) }
it { expect(group.group_members.masters.map(&:user)).to include(user) }
end
describe :add_users do
describe '#add_users' do
let(:user) { create(:user) }
before { group.add_users([user.id], GroupMember::GUEST) }
......@@ -124,7 +124,7 @@ describe Group, models: true do
end
end
describe :avatar_type do
describe '#avatar_type' do
let(:user) { create(:user) }
before { group.add_user(user, GroupMember::MASTER) }
......
......@@ -101,7 +101,7 @@ describe ProjectMember, models: true do
end
end
describe :add_users_into_projects do
describe '.add_users_into_projects' do
before do
@project_1 = create :project
@project_2 = create :project
......@@ -123,7 +123,7 @@ describe ProjectMember, models: true do
it { expect(@project_2.users).to include(@user_2) }
end
describe :truncate_teams do
describe '.truncate_teams' do
before do
@project_1 = create :project
@project_2 = create :project
......
......@@ -70,7 +70,7 @@ describe Milestone, models: true do
end
end
describe :expired? do
describe '#expired?' do
context "expired" do
before do
allow(milestone).to receive(:due_date).and_return(Date.today.prev_year)
......@@ -88,7 +88,7 @@ describe Milestone, models: true do
end
end
describe :percent_complete do
describe '#percent_complete' do
before do
allow(milestone).to receive_messages(
closed_items_count: 3,
......@@ -111,11 +111,11 @@ describe Milestone, models: true do
it { expect(milestone.is_empty?(user)).to be_falsey }
end
describe :can_be_closed? do
describe '#can_be_closed?' do
it { expect(milestone.can_be_closed?).to be_truthy }
end
describe :total_items_count do
describe '#total_items_count' do
before do
create :closed_issue, milestone: milestone
create :merge_request, milestone: milestone
......@@ -126,7 +126,7 @@ describe Milestone, models: true do
end
end
describe :can_be_closed? do
describe '#can_be_closed?' do
before do
milestone = create :milestone
create :closed_issue, milestone: milestone
......
......@@ -18,11 +18,11 @@ describe Namespace, models: true do
it { is_expected.to respond_to(:to_param) }
end
describe :to_param do
describe '#to_param' do
it { expect(namespace.to_param).to eq(namespace.path) }
end
describe :human_name do
describe '#human_name' do
it { expect(namespace.human_name).to eq(namespace.owner_name) }
end
......@@ -54,7 +54,7 @@ describe Namespace, models: true do
end
end
describe :move_dir do
describe '#move_dir' do
before do
@namespace = create :namespace
@project = create :project, namespace: @namespace
......@@ -98,7 +98,7 @@ describe Namespace, models: true do
end
end
describe :find_by_path_or_name do
describe '.find_by_path_or_name' do
before do
@namespace = create(:namespace, name: 'WoW', path: 'woW')
end
......
require 'spec_helper'
describe Project, models: true do
describe :authorization do
describe 'authorization' do
before do
@p1 = create(:project)
......
......@@ -57,7 +57,7 @@ describe BuildkiteService, models: true do
)
end
describe :webhook_url do
describe '#webhook_url' do
it 'returns the webhook url' do
expect(@service.webhook_url).to eq(
'https://webhook.buildkite.com/deliver/secret-sauce-webhook-token'
......@@ -65,7 +65,7 @@ describe BuildkiteService, models: true do
end
end
describe :commit_status_path do
describe '#commit_status_path' do
it 'returns the correct status page' do
expect(@service.commit_status_path('2ab7834c')).to eq(
'https://gitlab.buildkite.com/status/secret-sauce-status-token.json?commit=2ab7834c'
......@@ -73,7 +73,7 @@ describe BuildkiteService, models: true do
end
end
describe :build_page do
describe '#build_page' do
it 'returns the correct build page' do
expect(@service.build_page('2ab7834c', nil)).to eq(
'https://buildkite.com/account-name/example-project/builds?commit=2ab7834c'
......
......@@ -16,7 +16,7 @@ describe Repository, models: true do
repository.commit(merge_commit_sha)
end
describe :branch_names_contains do
describe '#branch_names_contains' do
subject { repository.branch_names_contains(sample_commit.id) }
it { is_expected.to include('master') }
......@@ -24,7 +24,7 @@ describe Repository, models: true do
it { is_expected.not_to include('fix') }
end
describe :tag_names_contains do
describe '#tag_names_contains' do
subject { repository.tag_names_contains(sample_commit.id) }
it { is_expected.to include('v1.1.0') }
......@@ -72,13 +72,13 @@ describe Repository, models: true do
end
end
describe :last_commit_for_path do
describe '#last_commit_for_path' do
subject { repository.last_commit_for_path(sample_commit.id, '.gitignore').id }
it { is_expected.to eq('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') }
end
describe :find_commits_by_message do
describe '#find_commits_by_message' do
subject { repository.find_commits_by_message('submodule').map{ |k| k.id } }
it { is_expected.to include('5937ac0a7beb003549fc5fd26fc247adbce4a52e') }
......@@ -87,7 +87,7 @@ describe Repository, models: true do
it { is_expected.not_to include('913c66a37b4a45b9769037c55c2d238bd0942d2e') }
end
describe :blob_at do
describe '#blob_at' do
context 'blank sha' do
subject { repository.blob_at(Gitlab::Git::BLANK_SHA, '.gitignore') }
......@@ -95,7 +95,7 @@ describe Repository, models: true do
end
end
describe :merged_to_root_ref? do
describe '#merged_to_root_ref?' do
context 'merged branch' do
subject { repository.merged_to_root_ref?('improve/awesome') }
......@@ -103,7 +103,7 @@ describe Repository, models: true do
end
end
describe :can_be_merged? do
describe '#can_be_merged?' do
context 'mergeable branches' do
subject { repository.can_be_merged?('0b4bc9a49b562e85de7cc9e834518ea6828729b9', 'master') }
......@@ -305,7 +305,7 @@ describe Repository, models: true do
end
end
describe :add_branch do
describe '#add_branch' do
context 'when pre hooks were successful' do
it 'should run without errors' do
hook = double(trigger: [true, nil])
......@@ -349,7 +349,7 @@ describe Repository, models: true do
end
end
describe :rm_branch do
describe '#rm_branch' do
context 'when pre hooks were successful' do
it 'should run without errors' do
allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_return([true, nil])
......@@ -386,7 +386,7 @@ describe Repository, models: true do
end
end
describe :commit_with_hooks do
describe '#commit_with_hooks' do
context 'when pre hooks were successful' do
before do
expect_any_instance_of(GitHooksService).to receive(:execute).
......
......@@ -22,11 +22,11 @@ describe Service, models: true do
@testable = @service.can_test?
end
describe :can_test do
describe '#can_test?' do
it { expect(@testable).to eq(true) }
end
describe :test do
describe '#test' do
let(:data) { 'test' }
it 'test runs execute' do
......@@ -45,7 +45,7 @@ describe Service, models: true do
@testable = @service.can_test?
end
describe :can_test do
describe '#can_test?' do
it { expect(@testable).to eq(true) }
end
end
......
......@@ -427,7 +427,7 @@ describe User, models: true do
end
end
describe :not_in_project do
describe '.not_in_project' do
before do
User.delete_all
@user = create :user
......@@ -598,7 +598,7 @@ describe User, models: true do
end
end
describe :avatar_type do
describe '#avatar_type' do
let(:user) { create(:user) }
it "should be true if avatar is image" do
......@@ -612,7 +612,7 @@ describe User, models: true do
end
end
describe :requires_ldap_check? do
describe '#requires_ldap_check?' do
let(:user) { User.new }
it 'is false when LDAP is disabled' do
......@@ -651,7 +651,7 @@ describe User, models: true do
end
context 'ldap synchronized user' do
describe :ldap_user? do
describe '#ldap_user?' do
it 'is true if provider name starts with ldap' do
user = create(:omniauth_user, provider: 'ldapmain')
expect(user.ldap_user?).to be_truthy
......@@ -668,7 +668,7 @@ describe User, models: true do
end
end
describe :ldap_identity do
describe '#ldap_identity' do
it 'returns ldap identity' do
user = create :omniauth_user
expect(user.ldap_identity.provider).not_to be_empty
......@@ -825,7 +825,7 @@ describe User, models: true do
end
end
describe :can_be_removed? do
describe '#can_be_removed?' do
subject { create(:user) }
context 'no owned groups' do
......
......@@ -9,7 +9,7 @@ describe Ci::CreateTriggerRequestService, services: true do
stub_ci_pipeline_to_return_yaml_file
end
describe :execute do
describe '#execute' do
context 'valid params' do
subject { service.execute(project, trigger, 'master') }
......
......@@ -8,7 +8,7 @@ module Ci
let(:commit) { project.ensure_pipeline(commit_sha, 'master') }
let(:build) { FactoryGirl.create(:ci_build, pipeline: commit) }
describe :execute do
describe '#execute' do
before { build }
context 'branch name' do
......
......@@ -13,7 +13,7 @@ module Ci
specific_runner.assign_to(project)
end
describe :execute do
describe '#execute' do
context 'runner follow tag list' do
it "picks build with the same tag" do
pending_build.tag_list = ["linux"]
......
......@@ -9,7 +9,7 @@ describe CreateCommitBuildsService, services: true do
stub_ci_pipeline_to_return_yaml_file
end
describe :execute do
describe '#execute' do
context 'valid params' do
let(:pipeline) do
service.execute(project, user,
......
......@@ -4,7 +4,7 @@ describe EventCreateService, services: true do
let(:service) { EventCreateService.new }
describe 'Issues' do
describe :open_issue do
describe '#open_issue' do
let(:issue) { create(:issue) }
it { expect(service.open_issue(issue, issue.author)).to be_truthy }
......@@ -14,7 +14,7 @@ describe EventCreateService, services: true do
end
end
describe :close_issue do
describe '#close_issue' do
let(:issue) { create(:issue) }
it { expect(service.close_issue(issue, issue.author)).to be_truthy }
......@@ -24,7 +24,7 @@ describe EventCreateService, services: true do
end
end
describe :reopen_issue do
describe '#reopen_issue' do
let(:issue) { create(:issue) }
it { expect(service.reopen_issue(issue, issue.author)).to be_truthy }
......@@ -36,7 +36,7 @@ describe EventCreateService, services: true do
end
describe 'Merge Requests' do
describe :open_mr do
describe '#open_mr' do
let(:merge_request) { create(:merge_request) }
it { expect(service.open_mr(merge_request, merge_request.author)).to be_truthy }
......@@ -46,7 +46,7 @@ describe EventCreateService, services: true do
end
end
describe :close_mr do
describe '#close_mr' do
let(:merge_request) { create(:merge_request) }
it { expect(service.close_mr(merge_request, merge_request.author)).to be_truthy }
......@@ -56,7 +56,7 @@ describe EventCreateService, services: true do
end
end
describe :merge_mr do
describe '#merge_mr' do
let(:merge_request) { create(:merge_request) }
it { expect(service.merge_mr(merge_request, merge_request.author)).to be_truthy }
......@@ -66,7 +66,7 @@ describe EventCreateService, services: true do
end
end
describe :reopen_mr do
describe '#reopen_mr' do
let(:merge_request) { create(:merge_request) }
it { expect(service.reopen_mr(merge_request, merge_request.author)).to be_truthy }
......@@ -80,7 +80,7 @@ describe EventCreateService, services: true do
describe 'Milestone' do
let(:user) { create :user }
describe :open_milestone do
describe '#open_milestone' do
let(:milestone) { create(:milestone) }
it { expect(service.open_milestone(milestone, user)).to be_truthy }
......@@ -90,7 +90,7 @@ describe EventCreateService, services: true do
end
end
describe :close_mr do
describe '#close_mr' do
let(:milestone) { create(:milestone) }
it { expect(service.close_milestone(milestone, user)).to be_truthy }
......@@ -100,7 +100,7 @@ describe EventCreateService, services: true do
end
end
describe :destroy_mr do
describe '#destroy_mr' do
let(:milestone) { create(:milestone) }
it { expect(service.destroy_milestone(milestone, user)).to be_truthy }
......
......@@ -12,7 +12,7 @@ describe Issues::CloseService, services: true do
project.team << [user2, :developer]
end
describe :execute do
describe '#execute' do
context "valid params" do
before do
perform_enqueued_jobs do
......
......@@ -12,7 +12,7 @@ describe MergeRequests::CloseService, services: true do
project.team << [user2, :developer]
end
describe :execute do
describe '#execute' do
context 'valid params' do
let(:service) { MergeRequests::CloseService.new(project, user, {}) }
......
......@@ -5,7 +5,7 @@ describe MergeRequests::CreateService, services: true do
let(:user) { create(:user) }
let(:assignee) { create(:user) }
describe :execute do
describe '#execute' do
context 'valid params' do
let(:opts) do
{
......
......@@ -11,7 +11,7 @@ describe MergeRequests::MergeService, services: true do
project.team << [user2, :developer]
end
describe :execute do
describe '#execute' do
context 'valid params' do
let(:service) { MergeRequests::MergeService.new(project, user, commit_message: 'Awesome message') }
......
......@@ -5,7 +5,7 @@ describe MergeRequests::RefreshService, services: true do
let(:user) { create(:user) }
let(:service) { MergeRequests::RefreshService }
describe :execute do
describe '#execute' do
before do
@user = create(:user)
group = create(:group)
......
......@@ -11,7 +11,7 @@ describe MergeRequests::ReopenService, services: true do
project.team << [user2, :developer]
end
describe :execute do
describe '#execute' do
context 'valid params' do
let(:service) { MergeRequests::ReopenService.new(project, user, {}) }
......
......@@ -9,7 +9,7 @@ describe Milestones::CloseService, services: true do
project.team << [user, :master]
end
describe :execute do
describe '#execute' do
before do
Milestones::CloseService.new(project, user, {}).execute(milestone)
end
......
......@@ -4,7 +4,7 @@ describe Milestones::CreateService, services: true do
let(:project) { create(:empty_project) }
let(:user) { create(:user) }
describe :execute do
describe '#execute' do
context "valid params" do
before do
project.team << [user, :master]
......
......@@ -5,7 +5,7 @@ describe Notes::CreateService, services: true do
let(:issue) { create(:issue, project: project) }
let(:user) { create(:user) }
describe :execute do
describe '#execute' do
context "valid params" do
before do
project.team << [user, :master]
......
......@@ -5,7 +5,7 @@ describe Notes::PostProcessService, services: true do
let(:issue) { create(:issue, project: project) }
let(:user) { create(:user) }
describe :execute do
describe '#execute' do
before do
project.team << [user, :master]
note_opts = {
......
......@@ -50,7 +50,7 @@ describe NotificationService, services: true do
update_custom_notification(:new_note, @u_custom_global)
end
describe :new_note do
describe '#new_note' do
it do
add_users_with_subscription(note.project, issue)
......@@ -306,7 +306,7 @@ describe NotificationService, services: true do
project.team << [merge_request.assignee, :master]
end
describe :new_note do
describe '#new_note' do
it "records sent notifications" do
# Ensure create SentNotification by noteable = merge_request 6 times, not noteable = note
expect(SentNotification).to receive(:record_note).with(note, any_args).exactly(4).times.and_call_original
......
......@@ -5,7 +5,7 @@ describe TestHookService, services: true do
let(:project) { create :project }
let(:hook) { create :project_hook, project: project }
describe :execute do
describe '#execute' do
it "should execute successfully" do
stub_request(:post, hook.url).to_return(status: 200)
expect(TestHookService.new.execute(hook, user)).to be_truthy
......
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