Commit 251d0116 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'rc/ce-to-ee-friday' into 'master'

CE Upstream - Friday

Closes gitlab-ce#27955

See merge request !1218
parents ef7dd1e9 dc09e7a0
......@@ -165,64 +165,7 @@ spinach 7 10: *spinach-knapsack
spinach 8 10: *spinach-knapsack
spinach 9 10: *spinach-knapsack
# Execute all testing suites against Ruby 2.1
.ruby-21: &ruby-21
image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.1-git-2.7-phantomjs-2.1"
<<: *use-db
only:
- master@gitlab-org/gitlab-ce
- master@gitlab-org/gitlab-ee
- master@gitlab/gitlabhq
- master@gitlab/gitlab-ee
cache:
key: "ruby21"
paths:
- vendor/ruby
.rspec-knapsack-ruby21: &rspec-knapsack-ruby21
<<: *rspec-knapsack
<<: *dedicated-runner
<<: *ruby-21
.spinach-knapsack-ruby21: &spinach-knapsack-ruby21
<<: *spinach-knapsack
<<: *dedicated-runner
<<: *ruby-21
rspec 0 20 ruby21: *rspec-knapsack-ruby21
rspec 1 20 ruby21: *rspec-knapsack-ruby21
rspec 2 20 ruby21: *rspec-knapsack-ruby21
rspec 3 20 ruby21: *rspec-knapsack-ruby21
rspec 4 20 ruby21: *rspec-knapsack-ruby21
rspec 5 20 ruby21: *rspec-knapsack-ruby21
rspec 6 20 ruby21: *rspec-knapsack-ruby21
rspec 7 20 ruby21: *rspec-knapsack-ruby21
rspec 8 20 ruby21: *rspec-knapsack-ruby21
rspec 9 20 ruby21: *rspec-knapsack-ruby21
rspec 10 20 ruby21: *rspec-knapsack-ruby21
rspec 11 20 ruby21: *rspec-knapsack-ruby21
rspec 12 20 ruby21: *rspec-knapsack-ruby21
rspec 13 20 ruby21: *rspec-knapsack-ruby21
rspec 14 20 ruby21: *rspec-knapsack-ruby21
rspec 15 20 ruby21: *rspec-knapsack-ruby21
rspec 16 20 ruby21: *rspec-knapsack-ruby21
rspec 17 20 ruby21: *rspec-knapsack-ruby21
rspec 18 20 ruby21: *rspec-knapsack-ruby21
rspec 19 20 ruby21: *rspec-knapsack-ruby21
spinach 0 10 ruby21: *spinach-knapsack-ruby21
spinach 1 10 ruby21: *spinach-knapsack-ruby21
spinach 2 10 ruby21: *spinach-knapsack-ruby21
spinach 3 10 ruby21: *spinach-knapsack-ruby21
spinach 4 10 ruby21: *spinach-knapsack-ruby21
spinach 5 10 ruby21: *spinach-knapsack-ruby21
spinach 6 10 ruby21: *spinach-knapsack-ruby21
spinach 7 10 ruby21: *spinach-knapsack-ruby21
spinach 8 10 ruby21: *spinach-knapsack-ruby21
spinach 9 10 ruby21: *spinach-knapsack-ruby21
# Other generic tests
.ruby-static-analysis: &ruby-static-analysis
variables:
SIMPLECOV: "false"
......
......@@ -6,13 +6,13 @@
(How one can reproduce the issue - this is very important)
### Expected behavior
### What is the current *bug* behavior?
(What you should see instead)
(What actually happens)
### Actual behavior
### What is the expected *correct* behavior?
(What actually happens)
(What you should see instead)
### Relevant logs and/or screenshots
......@@ -23,23 +23,23 @@ logs, and code as it's very hard to read otherwise.)
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
#### Results of GitLab application Check
#### Results of GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:check SANITIZE=true`)
`sudo gitlab-rake gitlab:env:info`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`)
(we will only investigate if the tests are passing)
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
#### Results of GitLab environment info
#### Results of GitLab application Check
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)
`sudo gitlab-rake gitlab:check SANITIZE=true`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`)
(we will only investigate if the tests are passing)
### Possible fixes
......
......@@ -31,8 +31,7 @@ AllCops:
- 'lib/gitlab/seeder.rb'
- 'generator_templates/**/*'
##################### Style ##################################
# Style #######################################################################
# Check indentation of private/protected visibility modifiers.
Style/AccessModifierIndentation:
......@@ -471,7 +470,7 @@ Style/WhileUntilModifier:
Style/WordArray:
Enabled: false
#################### Metrics ################################
# Metrics #####################################################################
# A calculated magnitude based on number of assignments,
# branches, and conditions.
......@@ -516,8 +515,7 @@ Metrics/PerceivedComplexity:
Enabled: true
Max: 18
#################### Lint ################################
# Lint ########################################################################
# Checks for useless access modifiers.
Lint/UselessAccessModifier:
......@@ -679,8 +677,7 @@ Lint/UselessSetterCall:
Lint/Void:
Enabled: true
##################### Performance ############################
# Performance #################################################################
# Use `casecmp` rather than `downcase ==`.
Performance/Casecmp:
......@@ -718,8 +715,7 @@ Performance/StringReplacement:
Performance/TimesMap:
Enabled: true
##################### Rails ##################################
# Rails #######################################################################
# Enables Rails cops.
Rails:
......@@ -767,7 +763,7 @@ Rails/ReadWriteAttribute:
Rails/ScopeArgs:
Enabled: true
##################### RSpec ##################################
# RSpec #######################################################################
# Check that instances are not being stubbed globally.
RSpec/AnyInstance:
......@@ -828,3 +824,9 @@ RSpec/NotToNot:
# Prefer using verifying doubles over normal doubles.
RSpec/VerifiedDoubles:
Enabled: false
# Custom ######################################################################
# Disallow the `git` and `github` arguments in the Gemfile.
GemFetcher:
Enabled: true
......@@ -15,7 +15,7 @@
- [Issue weight](#issue-weight)
- [Regression issues](#regression-issues)
- [Technical debt](#technical-debt)
- [Stewardship][#stewardship]
- [Stewardship](#stewardship)
- [Merge requests](#merge-requests)
- [Merge request guidelines](#merge-request-guidelines)
- [Contribution acceptance criteria](#contribution-acceptance-criteria)
......
......@@ -292,7 +292,7 @@ group :development, :test do
gem 'rspec-retry', '~> 0.4.5'
gem 'spinach-rails', '~> 0.2.1'
gem 'spinach-rerun-reporter', '~> 0.0.2'
gem 'rspec_profiling'
gem 'rspec_profiling', '~> 0.0.5'
# Prevent occasions where minitest is not bundled in packaged versions of ruby (see #3826)
gem 'minitest', '~> 5.7.0'
......
......@@ -662,7 +662,7 @@ GEM
rspec-retry (0.4.5)
rspec-core
rspec-support (3.5.0)
rspec_profiling (0.0.4)
rspec_profiling (0.0.5)
activerecord
pg
rails
......@@ -762,7 +762,7 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
sqlite3 (1.3.13)
stackprof (0.2.10)
state_machines (0.4.0)
state_machines-activemodel (0.4.0)
......@@ -992,7 +992,7 @@ DEPENDENCIES
rqrcode-rails3 (~> 0.1.7)
rspec-rails (~> 3.5.0)
rspec-retry (~> 0.4.5)
rspec_profiling
rspec_profiling (~> 0.0.5)
rubocop (~> 0.46.0)
rubocop-rspec (~> 1.9.1)
ruby-fogbugz (~> 0.2.1)
......@@ -1041,4 +1041,4 @@ DEPENDENCIES
wikicloth (= 0.8.1)
BUNDLED WITH
1.14.2
1.14.3
The GitLab Enterprise Edition (EE) license (the “EE License”)
Copyright (c) 2011-2016 GitLab B.V.
Copyright (c) 2011-2017 GitLab B.V.
This software and associated documentation files (the "Software") may only be
used if you (and any entity that you represent) have agreed to, and are in
......
......@@ -59,7 +59,7 @@ star, smile, etc.). Some good tips about code reviews can be found in our
## Feature Freeze
On the 7th of each month, RC1 of the upcoming release is created and deployed to GitLab.com and the stable branch for this release is frozen, which means master is no longer merged into it.
After the 7th (Pacific Standard Time Zone) of each month, RC1 of the upcoming release is created and deployed to GitLab.com and the stable branch for this release is frozen, which means master is no longer merged into it.
Merge requests may still be merged into master during this period,
but they will go into the _next_ release, unless they are manually cherry-picked into the stable branch.
By freezing the stable branches 2 weeks prior to a release, we reduce the risk of a last minute merge request potentially breaking things.
......
......@@ -91,6 +91,9 @@ require('./lib/utils/common_utils');
},
},
SanitizationFilter: {
'a[name]:not([href]):empty'(el, text) {
return el.outerHTML;
},
'dl'(el, text) {
let lines = text.trim().split('\n');
// Add two spaces to the front of subsequent list items lines,
......
......@@ -171,7 +171,7 @@ require('./smart_interval');
return $.getJSON(this.opts.ci_status_url, (function(_this) {
return function(data) {
var message, status, title;
if (data.status === '') {
if (!data.status) {
return;
}
if (data.environments && data.environments.length) _this.renderEnvironments(data.environments);
......
......@@ -9,6 +9,8 @@
}
.user-calendar-activities {
direction: ltr;
.str-truncated {
max-width: 70%;
}
......
......@@ -125,7 +125,6 @@
top: 100%;
left: 0;
z-index: 9;
max-width: 280px;
min-width: 240px;
margin-top: 2px;
margin-bottom: 0;
......@@ -137,6 +136,10 @@
border-radius: $border-radius-base;
box-shadow: 0 2px 4px $dropdown-shadow-color;
.filtered-search-input-container & {
max-width: 280px;
}
&.is-loading {
.dropdown-content {
display: none;
......
......@@ -69,10 +69,8 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
def access_levels_options
{
push_access_levels: ProtectedBranch::PushAccessLevel.human_access_levels.map { |id, text| { id: id, text: text } },
merge_access_levels: ProtectedBranch::MergeAccessLevel.human_access_levels.map { |id, text| { id: id, text: text } },
selected_merge_access_levels: @protected_branch.merge_access_levels.map { |access_level| access_level.user_id || access_level.access_level },
selected_push_access_levels: @protected_branch.push_access_levels.map { |access_level| access_level.user_id || access_level.access_level }
push_access_levels: ProtectedBranch::PushAccessLevel.human_access_levels.map { |id, text| { id: id, text: text, before_divider: true } },
merge_access_levels: ProtectedBranch::MergeAccessLevel.human_access_levels.map { |id, text| { id: id, text: text, before_divider: true } }
}
end
......
......@@ -250,21 +250,11 @@ class JiraService < IssueTrackerService
end
end
# Build remote link on JIRA properties
# Icons here must be available on WEB so JIRA can read the URL
# We are using a open word graphics icon which have LGPL license
def build_remote_link_props(url:, title:, resolved: false)
status = {
resolved: resolved
}
if resolved
status[:icon] = {
title: 'Closed',
url16x16: 'http://www.openwebgraphics.com/resources/data/1768/16x16_apply.png'
}
end
{
GlobalID: 'GitLab',
object: {
......
......@@ -10,6 +10,7 @@
- if @project && event.project != @project
%span at
%strong= link_to_project event.project
= clipboard_button(clipboard_text: event.ref_name, class: 'btn-clipboard btn-transparent', title: 'Copy branch to clipboard')
#{time_ago_with_tooltip(event.created_at)}
.pull-right
......
......@@ -16,13 +16,13 @@
gitlab_icon: "#{asset_path 'gitlab_logo.png'}",
ci_status: "#{@merge_request.head_pipeline ? @merge_request.head_pipeline.status : ''}",
ci_message: {
normal: "Job {{status}} for \"{{title}}\"",
normal: "Pipeline {{status}} for \"{{title}}\"",
preparing: "{{status}} job for \"{{title}}\""
},
ci_enable: #{@project.ci_service ? "true" : "false"},
ci_title: {
preparing: "{{status}} job",
normal: "Job {{status}}"
normal: "Pipeline {{status}}"
},
ci_sha: "#{@merge_request.head_pipeline ? @merge_request.head_pipeline.short_sha : ''}",
ci_pipeline: #{@merge_request.head_pipeline.try(:id).to_json},
......
---
title: Fixes dropdown width in admin project page
merge_request: 9002
author:
---
title: Fix contribution activity alignment
merge_request:
author:
---
title: Show Pipeline(not Job) in MR desktop notification
merge_request:
author:
---
title: Added the ability to copy a branch name to the clipboard
merge_request: 9103
author: Glenn Sayers
---
title: Update API docs for new namespace format
merge_request: 9073
author: Markus Koller
---
title: Remove JIRA closed status icon
merge_request:
author:
---
title: Added headers to protected branch access dropdowns
merge_request:
author:
---
title: upgrade babel 5.8.x to babel 6.22.x
merge_request: 9072
author:
---
title: upgrade to webpack v2.2
merge_request: 9078
author:
......@@ -106,15 +106,7 @@ Example response:
"id": 5,
"name": "Experimental",
"path": "h5bp",
"owner_id": null,
"created_at": "2016-04-05T21:40:49.152Z",
"updated_at": "2016-04-07T08:07:48.466Z",
"description": "foo",
"avatar": {
"url": null
},
"share_with_group_lock": false,
"visibility_level": 10
"kind": "group"
},
"avatar_url": null,
"star_count": 1,
......@@ -190,15 +182,7 @@ Example response:
"id": 4,
"name": "Twitter",
"path": "twitter",
"owner_id": null,
"created_at": "2016-06-17T07:47:24.216Z",
"updated_at": "2016-06-17T07:47:24.216Z",
"description": "Aliquid qui quis dignissimos distinctio ut commodi voluptas est.",
"avatar": {
"url": null
},
"share_with_group_lock": false,
"visibility_level": 20
"kind": "group"
},
"avatar_url": null,
"star_count": 0,
......@@ -237,15 +221,7 @@ Example response:
"id": 4,
"name": "Twitter",
"path": "twitter",
"owner_id": null,
"created_at": "2016-06-17T07:47:24.216Z",
"updated_at": "2016-06-17T07:47:24.216Z",
"description": "Aliquid qui quis dignissimos distinctio ut commodi voluptas est.",
"avatar": {
"url": null
},
"share_with_group_lock": false,
"visibility_level": 20
"kind": "group"
},
"avatar_url": null,
"star_count": 0,
......@@ -286,15 +262,7 @@ Example response:
"id": 5,
"name": "H5bp",
"path": "h5bp",
"owner_id": null,
"created_at": "2016-06-17T07:47:26.621Z",
"updated_at": "2016-06-17T07:47:26.621Z",
"description": "Id consequatur rem vel qui doloremque saepe.",
"avatar": {
"url": null
},
"share_with_group_lock": false,
"visibility_level": 20
"kind": "group"
},
"avatar_url": null,
"star_count": 0,
......@@ -434,15 +402,7 @@ Example response:
"id": 5,
"name": "Experimental",
"path": "h5bp",
"owner_id": null,
"created_at": "2016-04-05T21:40:49.152Z",
"updated_at": "2016-04-07T08:07:48.466Z",
"description": "foo",
"avatar": {
"url": null
},
"share_with_group_lock": false,
"visibility_level": 10
"kind": "group"
},
"avatar_url": null,
"star_count": 1,
......
......@@ -381,6 +381,8 @@ PUT /projects/:id/merge_requests/:merge_request_id
Must include at least one non-required attribute from above.
Must include at least one non-required attribute from above.
```json
{
"id": 1,
......
......@@ -57,7 +57,7 @@ Once you have the authorization code you can request an `access_token` using the
```
parameters = 'client_id=APP_ID&client_secret=APP_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=REDIRECT_URI'
RestClient.post 'http://localhost:3000/oauth/token', parameters
RestClient.post 'http://gitlab.example.com/oauth/token', parameters
# The response will be
{
......@@ -77,13 +77,13 @@ You can now make requests to the API with the access token returned.
The access token allows you to make requests to the API on a behalf of a user.
```
GET https://localhost:3000/api/v3/user?access_token=OAUTH-TOKEN
GET https://gitlab.example.com/api/v3/user?access_token=OAUTH-TOKEN
```
Or you can put the token to the Authorization header:
```
curl --header "Authorization: Bearer OAUTH-TOKEN" https://localhost:3000/api/v3/user
curl --header "Authorization: Bearer OAUTH-TOKEN" https://gitlab.example.com/api/v3/user
```
## Resource Owner Password Credentials
......
......@@ -72,13 +72,10 @@ Parameters:
"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"
"kind": "group"
},
"archived": false,
"avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
......@@ -125,13 +122,10 @@ Parameters:
"last_activity_at": "2013-09-30T13:46:02Z",
"creator_id": 3,
"namespace": {
"created_at": "2013-09-30T13:46:02Z",
"description": "",
"id": 4,
"name": "Brightbox",
"owner_id": 1,
"path": "brightbox",
"updated_at": "2013-09-30T13:46:02Z"
"kind": "group"
},
"permissions": {
"project_access": {
......@@ -210,13 +204,10 @@ Parameters:
"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"
"kind": "group"
},
"archived": false,
"avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
......@@ -260,13 +251,10 @@ Parameters:
"last_activity_at": "2013-09-30T13:46:02Z",
"creator_id": 3,
"namespace": {
"created_at": "2013-09-30T13:46:02Z",
"description": "",
"id": 4,
"name": "Brightbox",
"owner_id": 1,
"path": "brightbox",
"updated_at": "2013-09-30T13:46:02Z"
"kind": "group"
},
"permissions": {
"project_access": {
......@@ -398,13 +386,10 @@ Parameters:
"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"
"kind": "group"
},
"permissions": {
"project_access": {
......@@ -786,13 +771,10 @@ Example response:
"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"
"kind": "group"
},
"archived": true,
"avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
......@@ -854,13 +836,10 @@ Example response:
"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"
"kind": "group"
},
"archived": true,
"avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
......@@ -928,13 +907,10 @@ Example response:
"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"
"kind": "group"
},
"permissions": {
"project_access": {
......@@ -1013,13 +989,10 @@ Example response:
"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"
"kind": "group"
},
"permissions": {
"project_access": {
......
@snippets
Feature: Snippets User
Background:
Given I sign in as a user
And I have public "Personal snippet one" snippet
And I have private "Personal snippet private" snippet
And I have internal "Personal snippet internal" snippet
Scenario: I should see all my snippets
Given I visit my snippets page
Then I should see "Personal snippet one" in snippets
And I should see "Personal snippet private" in snippets
And I should see "Personal snippet internal" in snippets
Scenario: I can see only my private snippets
Given I visit my snippets page
And I click "Private" filter
Then I should not see "Personal snippet one" in snippets
And I should not see "Personal snippet internal" in snippets
And I should see "Personal snippet private" in snippets
Scenario: I can see only my public snippets
Given I visit my snippets page
And I click "Public" filter
Then I should see "Personal snippet one" in snippets
And I should not see "Personal snippet private" in snippets
And I should not see "Personal snippet internal" in snippets
Scenario: I can see only my internal snippets
Given I visit my snippets page
And I click "Internal" filter
Then I should see "Personal snippet internal" in snippets
And I should not see "Personal snippet private" in snippets
And I should not see "Personal snippet one" in snippets
class Spinach::Features::SnippetsUser < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedSnippet
step 'I visit my snippets page' do
visit dashboard_snippets_path
end
step 'I should see "Personal snippet one" in snippets' do
expect(page).to have_content "Personal snippet one"
end
step 'I should see "Personal snippet private" in snippets' do
expect(page).to have_content "Personal snippet private"
end
step 'I should see "Personal snippet internal" in snippets' do
expect(page).to have_content "Personal snippet internal"
end
step 'I should not see "Personal snippet one" in snippets' do
expect(page).not_to have_content "Personal snippet one"
end
step 'I should not see "Personal snippet private" in snippets' do
expect(page).not_to have_content "Personal snippet private"
end
step 'I should not see "Personal snippet internal" in snippets' do
expect(page).not_to have_content "Personal snippet internal"
end
step 'I click "Internal" filter' do
page.within('.snippet-scope-menu') do
click_link "Internal"
end
end
step 'I click "Private" filter' do
page.within('.snippet-scope-menu') do
click_link "Private"
end
end
step 'I click "Public" filter' do
page.within('.snippet-scope-menu') do
click_link "Public"
end
end
def snippet
@snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one")
end
end
module Gitlab
module ChatCommands
module Presenters
module Issuable
module IssueBase
def color(issuable)
issuable.open? ? '#38ae67' : '#d22852'
end
......
......@@ -2,7 +2,7 @@ module Gitlab
module ChatCommands
module Presenters
class IssueNew < Presenters::Base
include Presenters::Issuable
include Presenters::IssueBase
def present
in_channel_response(new_issue)
......
......@@ -2,7 +2,7 @@ module Gitlab
module ChatCommands
module Presenters
class IssueSearch < Presenters::Base
include Presenters::Issuable
include Presenters::IssueBase
def present
text = if @resource.count >= 5
......
......@@ -2,7 +2,7 @@ module Gitlab
module ChatCommands
module Presenters
class IssueShow < Presenters::Base
include Presenters::Issuable
include Presenters::IssueBase
def present
if @resource.confidential?
......
module RuboCop
module Cop
# Cop that checks for all gems specified in the Gemfile, and will
# alert if any gem is to be fetched not from the RubyGems index.
# This enforcement is done so as to minimize external build
# dependencies and build times.
# This cop prevents usage of the `git` and `github` arguments to `gem` in a
# `Gemfile` in order to avoid additional points of failure beyond
# rubygems.org.
class GemFetcher < RuboCop::Cop::Cop
MSG = 'Do not use gems from git repositories, only use gems from RubyGems.'
GIT_KEYS = [:git, :github]
def on_send(node)
file_path = node.location.expression.source_buffer.name
return unless file_path.end_with?("Gemfile")
return unless gemfile?(node)
func_name = node.children[1]
return unless func_name == :gem
......@@ -19,10 +17,21 @@ module RuboCop
node.children.last.each_node(:pair) do |pair|
key_name = pair.children[0].children[0].to_sym
if GIT_KEYS.include?(key_name)
add_offense(node, :selector)
add_offense(node, pair.source_range, MSG)
end
end
end
private
def gemfile?(node)
node
.location
.expression
.source_buffer
.name
.end_with?("Gemfile")
end
end
end
end
require_relative 'cop/migration/add_index'
require_relative 'cop/gem_fetcher'
require_relative 'cop/migration/add_column'
require_relative 'cop/migration/add_column_with_default'
require_relative 'cop/gem_fetcher'
require_relative 'cop/migration/add_index'
......@@ -35,15 +35,16 @@ RSpec.describe 'admin issues labels' do
it 'deletes all labels', js: true do
page.within '.labels' do
page.all('.btn-remove').each do |remove|
wait_for_ajax
remove.click
wait_for_ajax
end
end
page.within '.manage-labels-list' do
expect(page).not_to have_content('bug')
expect(page).not_to have_content('feature_label')
end
wait_for_ajax
expect(page).to have_content("There are no labels yet")
expect(page).not_to have_content('bug')
expect(page).not_to have_content('feature_label')
end
end
......
......@@ -251,6 +251,8 @@ describe 'Copy as GFM', feature: true, js: true do
'SanitizationFilter',
<<-GFM.strip_heredoc
<a name="named-anchor"></a>
<sub>sub</sub>
<dl>
......
......@@ -26,7 +26,11 @@ RSpec.shared_examples "protected branches > access control > CE" do
within(".protected-branches-list") do
find(".js-allowed-to-push").click
within('.js-allowed-to-push-container') { click_on access_type_name }
within('.js-allowed-to-push-container') do
expect(first("li")).to have_content("Roles")
click_on access_type_name
end
end
wait_for_ajax
......@@ -61,7 +65,11 @@ RSpec.shared_examples "protected branches > access control > CE" do
within(".protected-branches-list") do
find(".js-allowed-to-merge").click
within('.js-allowed-to-merge-container') { click_on access_type_name }
within('.js-allowed-to-merge-container') do
expect(first("li")).to have_content("Roles")
click_on access_type_name
end
end
wait_for_ajax
......
require 'rails_helper'
feature 'User Snippets', feature: true do
let(:author) { create(:user) }
let!(:public_snippet) { create(:personal_snippet, :public, author: author, title: "This is a public snippet") }
let!(:internal_snippet) { create(:personal_snippet, :internal, author: author, title: "This is an internal snippet") }
let!(:private_snippet) { create(:personal_snippet, :private, author: author, title: "This is a private snippet") }
background do
login_as author
visit dashboard_snippets_path
end
scenario 'View all of my snippets' do
expect(page).to have_content(public_snippet.title)
expect(page).to have_content(internal_snippet.title)
expect(page).to have_content(private_snippet.title)
end
scenario 'View my public snippets' do
page.within('.snippet-scope-menu') do
click_link "Public"
end
expect(page).to have_content(public_snippet.title)
expect(page).not_to have_content(internal_snippet.title)
expect(page).not_to have_content(private_snippet.title)
end
scenario 'View my internal snippets' do
page.within('.snippet-scope-menu') do
click_link "Internal"
end
expect(page).not_to have_content(public_snippet.title)
expect(page).to have_content(internal_snippet.title)
expect(page).not_to have_content(private_snippet.title)
end
scenario 'View my private snippets' do
page.within('.snippet-scope-menu') do
click_link "Private"
end
expect(page).not_to have_content(public_snippet.title)
expect(page).not_to have_content(internal_snippet.title)
expect(page).to have_content(private_snippet.title)
end
end
......@@ -4,6 +4,16 @@ module Ci
describe GitlabCiYamlProcessor, lib: true do
let(:path) { 'path' }
describe 'our current .gitlab-ci.yml' do
let(:config) { File.read("#{Rails.root}/.gitlab-ci.yml") }
it 'is valid' do
error_message = described_class.validation_message(config)
expect(error_message).to be_nil
end
end
describe '#build_attributes' do
describe 'coverage entry' do
subject { described_class.new(config, path).build_attributes(:rspec) }
......
......@@ -135,7 +135,7 @@ describe JiraService, models: true do
url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/#{merge_request.diff_head_sha}",
title: "GitLab: Solved by commit #{merge_request.diff_head_sha}.",
icon: { title: "GitLab", url16x16: "https://gitlab.com/favicon.ico" },
status: { resolved: true, icon: { url16x16: "http://www.openwebgraphics.com/resources/data/1768/16x16_apply.png", title: "Closed" } }
status: { resolved: true }
}
)
).once
......
......@@ -36,15 +36,21 @@ describe API::Groups, api: true do
expect(response).to have_http_status(200)
expect(json_response).to be_an Array
expect(json_response.length).to eq(1)
expect(json_response.first['name']).to eq(group1.name)
expect(json_response)
.to satisfy_one { |group| group['name'] == group1.name }
expect(json_response.first['ldap_cn']).to eq(group1.ldap_cn)
expect(json_response.first['ldap_access']).to eq(group1.ldap_access)
expect(json_response)
.to satisfy_one { |group| group['ldap_cn'] == group1.ldap_cn }
expect(json_response)
.to satisfy_one { |group| group['ldap_access'] == group1.ldap_access }
ldap_group_link = json_response.first['ldap_group_links'].first
expect(ldap_group_link['cn']).to eq(group1.ldap_cn)
expect(ldap_group_link['group_access']).to eq(group1.ldap_access)
expect(ldap_group_link['provider']).to eq('ldap')
expect(json_response).to satisfy_one do |group|
ldap_group_link = group['ldap_group_links'].first
ldap_group_link['cn'] == group1.ldap_cn &&
ldap_group_link['group_access'] == group1.ldap_access &&
ldap_group_link['provider'] == 'ldap'
end
end
it "does not include statistics" do
......@@ -79,7 +85,7 @@ describe API::Groups, api: true do
repository_size: 123,
lfs_objects_size: 234,
build_artifacts_size: 345,
}
}.stringify_keys
project1.statistics.update!(attributes)
......@@ -87,7 +93,8 @@ describe API::Groups, api: true do
expect(response).to have_http_status(200)
expect(json_response).to be_an Array
expect(json_response.find { |r| r['id'] == group1.id }['statistics']).to eq attributes.stringify_keys
expect(json_response)
.to satisfy_one { |group| group['statistics'] == attributes }
end
end
......
require 'spec_helper'
require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/gem_fetcher'
describe RuboCop::Cop::GemFetcher do
include CopHelper
subject(:cop) { described_class.new }
context 'in Gemfile' do
before do
allow(cop).to receive(:gemfile?).and_return(true)
end
it 'registers an offense when a gem uses `git`' do
inspect_source(cop, 'gem "foo", git: "https://gitlab.com/foo/bar.git"')
aggregate_failures do
expect(cop.offenses.size).to eq(1)
expect(cop.offenses.map(&:line)).to eq([1])
expect(cop.highlights).to eq(['git: "https://gitlab.com/foo/bar.git"'])
end
end
it 'registers an offense when a gem uses `github`' do
inspect_source(cop, 'gem "foo", github: "foo/bar.git"')
aggregate_failures do
expect(cop.offenses.size).to eq(1)
expect(cop.offenses.map(&:line)).to eq([1])
expect(cop.highlights).to eq(['github: "foo/bar.git"'])
end
end
end
context 'outside of Gemfile' do
it 'registers no offense' do
inspect_source(cop, 'gem "foo", git: "https://gitlab.com/foo/bar.git"')
expect(cop.offenses.size).to eq(0)
end
end
end
# These matchers are a syntactic hack to provide more readable expectations for
# an Enumerable object.
#
# They take advantage of the `all?`, `none?`, and `one?` methods, and the fact
# that RSpec provides a `be_something` matcher for all predicates.
#
# Example:
#
# # Ensure exactly one object in an Array satisfies a condition
# expect(users.one? { |u| u.admin? }).to eq true
#
# # The same thing, but using the `be_one` matcher
# expect(users).to be_one { |u| u.admin? }
#
# # The same thing again, but using `satisfy_one` for improved readability
# expect(users).to satisfy_one { |u| u.admin? }
RSpec::Matchers.alias_matcher :satisfy_all, :be_all
RSpec::Matchers.alias_matcher :satisfy_none, :be_none
RSpec::Matchers.alias_matcher :satisfy_one, :be_one
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