Commit feddb690 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents caa92cbc 39b72ec7
......@@ -149,10 +149,7 @@ gem 'icalendar'
gem 'diffy', '~> 3.1.0'
# Application server
# The 2.0.6 version of rack requires monkeypatch to be present in
# `config.ru`. This can be removed once a new update for Rack
# is available that contains https://github.com/rack/rack/pull/1201.
gem 'rack', '2.0.6'
gem 'rack', '~> 2.0.7'
group :unicorn do
gem 'unicorn', '~> 5.4.1'
......
......@@ -648,7 +648,7 @@ GEM
puma (>= 2.7, < 4)
pyu-ruby-sasl (0.0.3.3)
raabro (1.1.6)
rack (2.0.6)
rack (2.0.7)
rack-accept (0.4.5)
rack (>= 0.4)
rack-attack (4.4.1)
......@@ -1142,7 +1142,7 @@ DEPENDENCIES
pry-rails (~> 0.3.4)
puma (~> 3.12)
puma_worker_killer
rack (= 2.0.6)
rack (~> 2.0.7)
rack-attack (~> 4.4.1)
rack-cors (~> 1.0.0)
rack-oauth2 (~> 1.9.3)
......
......@@ -100,6 +100,7 @@ module IssuableCollections
if @project
options[:project_id] = @project.id
options[:attempt_project_search_optimizations] = true
elsif @group
options[:group_id] = @group.id
options[:include_subgroups] = true
......
......@@ -83,7 +83,7 @@ class IssuableFinder
# https://www.postgresql.org/docs/current/static/queries-with.html
items = by_search(items)
items = sort(items) unless use_cte_for_count?
items = sort(items)
items
end
......@@ -91,7 +91,6 @@ class IssuableFinder
def filter_items(items)
items = by_project(items)
items = by_group(items)
items = by_subquery(items)
items = by_scope(items)
items = by_created_at(items)
items = by_updated_at(items)
......@@ -131,10 +130,12 @@ class IssuableFinder
# This does not apply when we are using a CTE for the search, as the labels
# GROUP BY is inside the subquery in that case, so we set labels_count to 1.
#
# We always use CTE when searching in Groups if the feature flag is enabled,
# but never when searching in Projects.
# Groups and projects have separate feature flags to suggest the use
# of a CTE. The CTE will not be used if the sort doesn't support it,
# but will always be used for the counts here as we ignore sorting
# anyway.
labels_count = label_names.any? ? label_names.count : 1
labels_count = 1 if use_cte_for_count?
labels_count = 1 if use_cte_for_search?
finder.execute.reorder(nil).group(:state).count.each do |key, value|
counts[count_key(key)] += value / labels_count
......@@ -308,15 +309,14 @@ class IssuableFinder
end
# rubocop: enable CodeReuse/ActiveRecord
def use_subquery_for_search?
strong_memoize(:use_subquery_for_search) do
!force_cte? && attempt_group_search_optimizations?
end
end
def use_cte_for_search?
strong_memoize(:use_cte_for_search) do
next false unless search
next false unless Gitlab::Database.postgresql?
# Only simple unsorted & simple sorts can use CTE
next false if params[:sort].present? && !params[:sort].in?(klass.simple_sorts.keys)
def use_cte_for_count?
strong_memoize(:use_cte_for_count) do
force_cte? && attempt_group_search_optimizations?
attempt_group_search_optimizations? || attempt_project_search_optimizations?
end
end
......@@ -331,12 +331,15 @@ class IssuableFinder
end
def attempt_group_search_optimizations?
search &&
Gitlab::Database.postgresql? &&
params[:attempt_group_search_optimizations] &&
params[:attempt_group_search_optimizations] &&
Feature.enabled?(:attempt_group_search_optimizations, default_enabled: true)
end
def attempt_project_search_optimizations?
params[:attempt_project_search_optimizations] &&
Feature.enabled?(:attempt_project_search_optimizations)
end
def count_key(value)
Array(value).last.to_sym
end
......@@ -407,20 +410,11 @@ class IssuableFinder
end
# rubocop: enable CodeReuse/ActiveRecord
# Wrap projects and groups in a subquery if the conditions are met.
def by_subquery(items)
if use_subquery_for_search?
klass.where(id: items.select(:id)) # rubocop: disable CodeReuse/ActiveRecord
else
items
end
end
# rubocop: disable CodeReuse/ActiveRecord
def by_search(items)
return items unless search
if use_cte_for_count?
if use_cte_for_search?
cte = Gitlab::SQL::RecursiveCTE.new(klass.table_name)
cte << items
......
......@@ -223,6 +223,13 @@ class ApplicationSetting < ApplicationRecord
reset_memoized_terms
end
after_commit :expire_performance_bar_allowed_user_ids_cache, if: -> { previous_changes.key?('performance_bar_allowed_group_id') }
def self.create_from_defaults
super
rescue ActiveRecord::RecordNotUnique
# We already have an ApplicationSetting record, so just return it.
current_without_cache
end
end
ApplicationSetting.prepend(EE::ApplicationSetting)
......@@ -174,6 +174,10 @@ module Issuable
fuzzy_search(query, matched_columns)
end
def simple_sorts
super.except('name_asc', 'name_desc')
end
def sort_by_attribute(method, excluded_labels: [])
sorted =
case method.to_s
......
......@@ -21,19 +21,21 @@ module Sortable
class_methods do
def order_by(method)
case method.to_s
when 'created_asc' then order_created_asc
when 'created_date' then order_created_desc
when 'created_desc' then order_created_desc
when 'id_asc' then order_id_asc
when 'id_desc' then order_id_desc
when 'name_asc' then order_name_asc
when 'name_desc' then order_name_desc
when 'updated_asc' then order_updated_asc
when 'updated_desc' then order_updated_desc
else
all
end
simple_sorts.fetch(method.to_s, -> { all }).call
end
def simple_sorts
{
'created_asc' => -> { order_created_asc },
'created_date' => -> { order_created_desc },
'created_desc' => -> { order_created_desc },
'id_asc' => -> { order_id_asc },
'id_desc' => -> { order_id_desc },
'name_asc' => -> { order_name_asc },
'name_desc' => -> { order_name_desc },
'updated_asc' => -> { order_updated_asc },
'updated_desc' => -> { order_updated_desc }
}
end
private
......
......@@ -7,7 +7,7 @@ module MergeRequests
def execute(commit_status)
return if commit_status.allow_failure? || commit_status.retried?
commit_status_merge_requests(commit_status) do |merge_request|
pipeline_merge_requests(commit_status.pipeline) do |merge_request|
todo_service.merge_request_build_failed(merge_request)
end
end
......@@ -16,7 +16,7 @@ module MergeRequests
# build is retried
#
def close(commit_status)
commit_status_merge_requests(commit_status) do |merge_request|
pipeline_merge_requests(commit_status.pipeline) do |merge_request|
todo_service.merge_request_build_retried(merge_request)
end
end
......
......@@ -99,23 +99,12 @@ module MergeRequests
# rubocop: enable CodeReuse/ActiveRecord
def pipeline_merge_requests(pipeline)
merge_requests_for(pipeline.ref).each do |merge_request|
pipeline.all_merge_requests.opened.each do |merge_request|
next unless pipeline == merge_request.head_pipeline
yield merge_request
end
end
def commit_status_merge_requests(commit_status)
merge_requests_for(commit_status.ref).each do |merge_request|
pipeline = merge_request.head_pipeline
next unless pipeline
next unless pipeline.sha == commit_status.sha
yield merge_request
end
end
end
end
......
---
title: Speed up filtering issues in a project when searching
merge_request:
author:
type: performance
---
title: Fix MWPS does not work for merge request pipelines
merge_request: 26906
author:
type: fixed
......@@ -13,10 +13,6 @@ if defined?(Unicorn)
# Max memory size (RSS) per worker
use Unicorn::WorkerKiller::Oom, min, max
end
# Monkey patch for fixing Rack 2.0.6 bug:
# https://gitlab.com/gitlab-org/gitlab-ee/issues/8539
Unicorn::StreamInput.send(:public, :eof?) # rubocop:disable GitlabSecurity/PublicSend
end
require ::File.expand_path('../config/environment', __FILE__)
......
# frozen_string_literal: true
puts "Creating the default ApplicationSetting record.".color(:green)
Gitlab::CurrentSettings.current_application_settings
# Details https://gitlab.com/gitlab-org/gitlab-ce/issues/46241
puts "Enable hashed storage for every new projects.".color(:green)
ApplicationSetting.current_without_cache.update!(hashed_storage_enabled: true)
print '.'
# frozen_string_literal: true
# Enable hashed storage, in development mode, for all projects by default.
Gitlab::Seeder.quiet do
ApplicationSetting.create_from_defaults unless ApplicationSetting.current_without_cache
ApplicationSetting.current_without_cache.update!(hashed_storage_enabled: true)
print '.'
end
# We want to enable hashed storage for every new project in development
# Details https://gitlab.com/gitlab-org/gitlab-ce/issues/46241
Gitlab::Seeder.quiet do
ApplicationSetting.create_from_defaults unless ApplicationSetting.current_without_cache
ApplicationSetting.current_without_cache.update!(hashed_storage_enabled: true)
print '.'
end
# frozen_string_literal: true
puts "Creating the default ApplicationSetting record.".color(:green)
Gitlab::CurrentSettings.current_application_settings
......@@ -23,6 +23,9 @@ future GitLab releases.**
| `CHAT_INPUT` | 10.6 | all | Additional arguments passed in the [ChatOps](../chatops/README.md) command |
| `CHAT_CHANNEL` | 10.6 | all | Source chat channel which triggered the [ChatOps](../chatops/README.md) command |
| `CI` | all | 0.4 | Mark that job is executed in CI environment |
| `CI_BUILDS_DIR` | all | 11.10 | Top-level directory where builds are executed. |
| `CI_CONCURRENT_ID` | all | 11.10 | Unique ID of build execution within a single executor. |
| `CI_CONCURRENT_PROJECT_ID` | all | 11.10 | Unique ID of build execution within a single executor and project. |
| `CI_COMMIT_BEFORE_SHA` | 11.2 | all | The previous latest commit present on a branch before a push request. |
| `CI_COMMIT_DESCRIPTION` | 10.8 | all | The description of the commit: the message without first line, if the title is shorter than 100 characters; full message in other case. |
| `CI_COMMIT_MESSAGE` | 10.8 | all | The full commit message. |
......
......@@ -2362,8 +2362,35 @@ variables:
GIT_STRATEGY: clone
GIT_CHECKOUT: "false"
script:
- git checkout master
- git merge $CI_BUILD_REF_NAME
- git checkout -B master origin/master
- git merge $CI_COMMIT_SHA
```
#### Git clean flags
> Introduced in GitLab Runner 11.10
The `GIT_CLEAN_FLAGS` variable is used to control the default behavior of
`git clean` after checking out the sources. You can set it globally or per-job in the
[`variables`](#variables) section.
`GIT_CLEAN_FLAGS` accepts all possible options of the [git clean](https://git-scm.com/docs/git-clean)
command.
`git clean` is disabled if `GIT_CHECKOUT: "false"` is specified.
If `GIT_CLEAN_FLAGS` is:
- Not specified, `git clean` flags default to `-ffdx`.
- Given the value `none`, `git clean` is not executed.
For example:
```yaml
variables:
GIT_CLEAN_FLAGS: -ffdx -e cache/
script:
- ls -al cache/
```
#### Job stages attempts
......@@ -2439,6 +2466,72 @@ CAUTION: **Deprecated:**
`type` is deprecated, and could be removed in one of the future releases.
Use [`stage`](#stage) instead.
## Custom build directories
> [Introduced][https://gitlab.com/gitlab-org/gitlab-runner/merge_requests/1267] in Gitlab Runner 11.10
NOTE: **Note:**
This can only be used when `custom_build_dir` is enabled in the [Runner's
configuration](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnerscustom_build_dir-section).
This is the default configuration for `docker` and `kubernetes` executor.
By default, GitLab Runner clones the repository in a unique subpath of the `$CI_BUILDS_DIR` directory.
However, sometimes your project might require the code in a specific directory,
but sometimes your project might require to have the code in a specific directory,
like Go projects, for example. In that case, you can specify the `GIT_CLONE_PATH` variable
to tell the Runner in which directory to clone the repository:
```yml
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR/project-name
test:
script:
- pwd
```
The `GIT_CLONE_PATH` has to always be within `$CI_BUILDS_DIR`. The directory set in `$CI_BUILDS_DIR`
is dependent on executor and configuration of [runners.builds_dir](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section)
setting.
### Handling concurrency
An executor using a concurrency greater than `1` might lead
to failures because multiple jobs might be working on the same directory if the `builds_dir`
is shared between jobs.
GitLab Runner does not try to prevent this situation. It is up to the administrator
and developers to comply with the requirements of Runner configuration.
To avoid this scenario, you can use a unique path within `$CI_BUILDS_DIR`, because Runner
exposes two additional variables that provide a unique `ID` of concurrency:
- `$CI_CONCURRENT_ID`: Unique ID for all jobs running within the given executor.
- `$CI_CONCURRENT_PROJECT_ID`: Unique ID for all jobs running within the given executor and project.
The most stable configuration that should work well in any scenario and on any executor
is to use `$CI_CONCURRENT_ID` in the `GIT_CLONE_PATH`. For example:
```yml
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/project-name
test:
script:
- pwd
```
The `$CI_CONCURRENT_PROJECT_ID` should be used in conjunction with `$CI_PROJECT_PATH`
as the `$CI_PROJECT_PATH` provides a path of a repository. That is, `group/subgroup/project`. For example:
```yml
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/$CI_PROJECT_PATH
test:
script:
- pwd
```
## Special YAML features
It's possible to use special YAML features like anchors (`&`), aliases (`*`)
......
......@@ -3,7 +3,7 @@ require Rails.root.join('config', 'object_store_settings.rb')
describe ObjectStoreSettings do
describe '.parse' do
it 'should set correct default values' do
it 'sets correct default values' do
settings = described_class.parse(nil)
expect(settings['enabled']).to be false
......
......@@ -75,7 +75,7 @@ describe Dashboard::MilestonesController do
expect(response.body).not_to include(project_milestone.title)
end
it 'should show counts of group and project milestones to which the user belongs to' do
it 'shows counts of group and project milestones to which the user belongs to' do
get :index
expect(response.body).to include("Open\n<span class=\"badge badge-pill\">2</span>")
......
......@@ -455,7 +455,7 @@ describe Groups::ClustersController do
context 'when domain is invalid' do
let(:domain) { 'http://not-a-valid-domain' }
it 'should not update cluster attributes' do
it 'does not update cluster attributes' do
go
cluster.reload
......
......@@ -124,7 +124,7 @@ describe Groups::Settings::CiCdController do
end
context 'when explicitly enabling auto devops' do
it 'should update group attribute' do
it 'updates group attribute' do
expect(group.auto_devops_enabled).to eq(true)
end
end
......@@ -132,7 +132,7 @@ describe Groups::Settings::CiCdController do
context 'when explicitly disabling auto devops' do
let(:auto_devops_param) { '0' }
it 'should update group attribute' do
it 'updates group attribute' do
expect(group.auto_devops_enabled).to eq(false)
end
end
......
......@@ -605,11 +605,11 @@ describe GroupsController do
}
end
it 'should return a notice' do
it 'returns a notice' do
expect(flash[:notice]).to eq("Group '#{group.name}' was successfully transferred.")
end
it 'should redirect to the new path' do
it 'redirects to the new path' do
expect(response).to redirect_to("/#{new_parent_group.path}/#{group.path}")
end
end
......@@ -626,11 +626,11 @@ describe GroupsController do
}
end
it 'should return a notice' do
it 'returns a notice' do
expect(flash[:notice]).to eq("Group '#{group.name}' was successfully transferred.")
end
it 'should redirect to the new path' do
it 'redirects to the new path' do
expect(response).to redirect_to("/#{group.path}")
end
end
......@@ -650,11 +650,11 @@ describe GroupsController do
}
end
it 'should return an alert' do
it 'returns an alert' do
expect(flash[:alert]).to eq "Transfer failed: namespace directory cannot be moved"
end
it 'should redirect to the current path' do
it 'redirects to the current path' do
expect(response).to redirect_to(edit_group_path(group))
end
end
......@@ -672,7 +672,7 @@ describe GroupsController do
}
end
it 'should be denied' do
it 'is denied' do
expect(response).to have_gitlab_http_status(404)
end
end
......
......@@ -55,7 +55,7 @@ describe OmniauthCallbacksController, type: :controller do
allow(@routes).to receive(:generate_extras) { [path, []] }
end
it 'it calls through to the failure handler' do
it 'calls through to the failure handler' do
request.env['omniauth.error'] = OneLogin::RubySaml::ValidationError.new("Fingerprint mismatch")
request.env['omniauth.error.strategy'] = OmniAuth::Strategies::SAML.new(nil)
stub_route_as('/users/auth/saml/callback')
......
......@@ -285,7 +285,7 @@ describe Projects::BlobController do
merge_request.update!(source_project: other_project, target_project: other_project)
end
it "it redirect to blob" do
it "redirects to blob" do
put :update, params: mr_params
expect(response).to redirect_to(blob_after_edit_path)
......
......@@ -16,15 +16,15 @@ describe Projects::Ci::LintsController do
get :show, params: { namespace_id: project.namespace, project_id: project }
end
it 'should be success' do
it 'is success' do
expect(response).to be_success
end
it 'should render show page' do
it 'renders show page' do
expect(response).to render_template :show
end
it 'should retrieve project' do
it 'retrieves project' do
expect(assigns(:project)).to eq(project)
end
end
......@@ -36,7 +36,7 @@ describe Projects::Ci::LintsController do
get :show, params: { namespace_id: project.namespace, project_id: project }
end
it 'should respond with 404' do
it 'responds with 404' do
expect(response).to have_gitlab_http_status(404)
end
end
......@@ -74,7 +74,7 @@ describe Projects::Ci::LintsController do
post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
end
it 'should be success' do
it 'is success' do
expect(response).to be_success
end
......@@ -82,7 +82,7 @@ describe Projects::Ci::LintsController do
expect(response).to render_template :show
end
it 'should retrieve project' do
it 'retrieves project' do
expect(assigns(:project)).to eq(project)
end
end
......@@ -102,7 +102,7 @@ describe Projects::Ci::LintsController do
post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
end
it 'should assign errors' do
it 'assigns errors' do
expect(assigns[:error]).to eq('jobs:rubocop config contains unknown keys: scriptt')
end
end
......@@ -114,7 +114,7 @@ describe Projects::Ci::LintsController do
post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
end
it 'should respond with 404' do
it 'responds with 404' do
expect(response).to have_gitlab_http_status(404)
end
end
......
......@@ -15,7 +15,7 @@ describe Projects::CommitsController do
describe "GET commits_root" do
context "no ref is provided" do
it 'should redirect to the default branch of the project' do
it 'redirects to the default branch of the project' do
get(:commits_root,
params: {
namespace_id: project.namespace,
......
......@@ -65,7 +65,7 @@ describe Projects::MirrorsController do
expect(flash[:notice]).to match(/successfully updated/)
end
it 'should create a RemoteMirror object' do
it 'creates a RemoteMirror object' do
expect { do_put(project, remote_mirrors_attributes: remote_mirror_attributes) }.to change(RemoteMirror, :count).by(1)
end
end
......@@ -82,7 +82,7 @@ describe Projects::MirrorsController do
expect(flash[:alert]).to match(/Only allowed protocols are/)
end
it 'should not create a RemoteMirror object' do
it 'does not create a RemoteMirror object' do
expect { do_put(project, remote_mirrors_attributes: remote_mirror_attributes) }.not_to change(RemoteMirror, :count)
end
end
......
......@@ -6,7 +6,7 @@ describe Projects::ProjectMembersController do
let(:namespace) { create :group }
describe 'GET index' do
it 'should have the project_members address with a 200 status code' do
it 'has the project_members address with a 200 status code' do
get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200)
......
......@@ -147,7 +147,7 @@ describe Projects::ServicesController do
params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: { namespace: 'updated_namespace' } }
end
it 'should not update the service' do
it 'does not update the service' do
service.reload
expect(service.namespace).not_to eq('updated_namespace')
end
......@@ -172,7 +172,7 @@ describe Projects::ServicesController do
context 'with approved services' do
let(:service_id) { 'jira' }
it 'should render edit page' do
it 'renders edit page' do
expect(response).to be_success
end
end
......@@ -180,7 +180,7 @@ describe Projects::ServicesController do
context 'with a deprecated service' do
let(:service_id) { 'kubernetes' }
it 'should render edit page' do
it 'renders edit page' do
expect(response).to be_success
end
end
......
......@@ -14,11 +14,11 @@ describe UserCalloutsController do
let(:feature_name) { UserCallout.feature_names.keys.first }
context 'when callout entry does not exist' do
it 'should create a callout entry with dismissed state' do
it 'creates a callout entry with dismissed state' do
expect { subject }.to change { UserCallout.count }.by(1)
end
it 'should return success' do
it 'returns success' do
subject
expect(response).to have_gitlab_http_status(:ok)
......@@ -28,7 +28,7 @@ describe UserCalloutsController do
context 'when callout entry already exists' do
let!(:callout) { create(:user_callout, feature_name: UserCallout.feature_names.keys.first, user: user) }
it 'should return success' do
it 'returns success' do
subject
expect(response).to have_gitlab_http_status(:ok)
......@@ -39,7 +39,7 @@ describe UserCalloutsController do
context 'with invalid feature name' do
let(:feature_name) { 'bogus_feature_name' }
it 'should return bad request' do
it 'returns bad request' do
subject
expect(response).to have_gitlab_http_status(:bad_request)
......
......@@ -34,7 +34,7 @@ describe 'Expand and collapse diffs', :js do
define_method(file.split('.').first) { file_container(file) }
end
it 'should show the diff content with a highlighted line when linking to line' do
it 'shows the diff content with a highlighted line when linking to line' do
expect(large_diff).not_to have_selector('.code')
expect(large_diff).to have_selector('.nothing-here-block')
......@@ -48,7 +48,7 @@ describe 'Expand and collapse diffs', :js do
expect(large_diff).to have_selector('.hll')
end
it 'should show the diff content when linking to file' do
it 'shows the diff content when linking to file' do
expect(large_diff).not_to have_selector('.code')
expect(large_diff).to have_selector('.nothing-here-block')
......
......@@ -68,17 +68,17 @@ describe 'Explore Groups page', :js do
end
describe 'landing component' do
it 'should show a landing component' do
it 'shows a landing component' do
expect(page).to have_content('Below you will find all the groups that are public.')
end
it 'should be dismissable' do
it 'is dismissable' do
find('.dismiss-button').click
expect(page).not_to have_content('Below you will find all the groups that are public.')
end
it 'should persistently not show once dismissed' do
it 'does not show persistently once dismissed' do
find('.dismiss-button').click
visit explore_groups_path
......
......@@ -43,7 +43,7 @@ describe 'Group CI/CD settings' do
end
context 'as owner first visiting group settings' do
it 'should see instance enabled badge' do
it 'sees instance enabled badge' do
visit group_settings_ci_cd_path(group)
page.within '#auto-devops-settings' do
......@@ -53,7 +53,7 @@ describe 'Group CI/CD settings' do
end
context 'when Auto DevOps group has been enabled' do
it 'should see group enabled badge' do
it 'sees group enabled badge' do
group.update!(auto_devops_enabled: true)
visit group_settings_ci_cd_path(group)
......@@ -65,7 +65,7 @@ describe 'Group CI/CD settings' do
end
context 'when Auto DevOps group has been disabled' do
it 'should not see a badge' do
it 'does not see a badge' do
group.update!(auto_devops_enabled: false)
visit group_settings_ci_cd_path(group)
......
......@@ -237,7 +237,7 @@ describe 'Group' do
let!(:project) { create(:project, namespace: group) }
let!(:path) { group_path(group) }
it 'it renders projects and groups on the page' do
it 'renders projects and groups on the page' do
visit path
wait_for_requests
......
......@@ -82,15 +82,15 @@ describe 'Help Pages' do
visit help_path
end
it 'should display custom help page text' do
it 'displays custom help page text' do
expect(page).to have_text "My Custom Text"
end
it 'should hide marketing content when enabled' do
it 'hides marketing content when enabled' do
expect(page).not_to have_link "Get a support subscription"
end
it 'should use a custom support url' do
it 'uses a custom support url' do
expect(page).to have_link "See our website for getting help", href: "http://example.com/help"
end
end
......
......@@ -42,7 +42,7 @@ describe 'Dropdown assignee', :js do
expect(page).to have_css(js_dropdown_assignee, visible: false)
end
it 'should show loading indicator when opened' do
it 'shows loading indicator when opened' do
slow_requests do
# We aren't using `input_filtered_search` because we want to see the loading indicator
filtered_search.set('assignee:')
......@@ -51,13 +51,13 @@ describe 'Dropdown assignee', :js do
end
end
it 'should hide loading indicator when loaded' do
it 'hides loading indicator when loaded' do
input_filtered_search('assignee:', submit: false, extra_space: false)
expect(find(js_dropdown_assignee)).not_to have_css('.filter-dropdown-loading')
end
it 'should load all the assignees when opened' do
it 'loads all the assignees when opened' do
input_filtered_search('assignee:', submit: false, extra_space: false)
expect(dropdown_assignee_size).to eq(4)
......
......@@ -50,7 +50,7 @@ describe 'Dropdown author', :js do
expect(page).to have_css(js_dropdown_author, visible: false)
end
it 'should show loading indicator when opened' do
it 'shows loading indicator when opened' do
slow_requests do
filtered_search.set('author:')
......@@ -58,13 +58,13 @@ describe 'Dropdown author', :js do
end
end
it 'should hide loading indicator when loaded' do
it 'hides loading indicator when loaded' do
send_keys_to_filtered_search('author:')
expect(page).not_to have_css('#js-dropdown-author .filter-dropdown-loading')
end
it 'should load all the authors when opened' do
it 'loads all the authors when opened' do
send_keys_to_filtered_search('author:')
expect(dropdown_author_size).to eq(4)
......
......@@ -69,7 +69,7 @@ describe 'Dropdown emoji', :js do
expect(page).to have_css(js_dropdown_emoji, visible: false)
end
it 'should show loading indicator when opened' do
it 'shows loading indicator when opened' do
slow_requests do
filtered_search.set('my-reaction:')
......@@ -77,13 +77,13 @@ describe 'Dropdown emoji', :js do
end
end
it 'should hide loading indicator when loaded' do
it 'hides loading indicator when loaded' do
send_keys_to_filtered_search('my-reaction:')
expect(page).not_to have_css('#js-dropdown-my-reaction .filter-dropdown-loading')
end
it 'should load all the emojis when opened' do
it 'loads all the emojis when opened' do
send_keys_to_filtered_search('my-reaction:')
expect(dropdown_emoji_size).to eq(4)
......
......@@ -49,7 +49,7 @@ describe 'Dropdown milestone', :js do
expect(page).to have_css(js_dropdown_milestone, visible: false)
end
it 'should show loading indicator when opened' do
it 'shows loading indicator when opened' do
slow_requests do
filtered_search.set('milestone:')
......@@ -57,13 +57,13 @@ describe 'Dropdown milestone', :js do
end
end
it 'should hide loading indicator when loaded' do
it 'hides loading indicator when loaded' do
filtered_search.set('milestone:')
expect(find(js_dropdown_milestone)).not_to have_css('.filter-dropdown-loading')
end
it 'should load all the milestones when opened' do
it 'loads all the milestones when opened' do
filtered_search.set('milestone:')
expect(filter_dropdown).to have_selector('.filter-dropdown .filter-dropdown-item', count: 6)
......
......@@ -47,7 +47,7 @@ describe 'New/edit issue', :js do
wait_for_requests
end
it 'should display selected users even if they are not part of the original API call' do
it 'displays selected users even if they are not part of the original API call' do
find('.dropdown-input-field').native.send_keys user2.name
page.within '.dropdown-menu-user' do
......
......@@ -26,7 +26,7 @@ describe 'Issue Detail', :js do
wait_for_requests
end
it 'should encode the description to prevent xss issues' do
it 'encodes the description to prevent xss issues' do
page.within('.issuable-details .detail-page-description') do
expect(page).to have_selector('img', count: 1)
expect(find('img')['onerror']).to be_nil
......
......@@ -145,7 +145,7 @@ describe 'Labels Hierarchy', :js, :nested_groups do
visit new_project_issue_path(project_1)
end
it 'should be able to assign ancestor group labels' do
it 'is able to assign ancestor group labels' do
fill_in 'issue_title', with: 'new created issue'
fill_in 'issue_description', with: 'new issue description'
......
......@@ -76,7 +76,7 @@ describe 'create a merge request, allowing commits from members who can merge to
sign_in(member)
end
it 'it hides the option from members' do
it 'hides the option from members' do
visit edit_project_merge_request_path(target_project, merge_request)
expect(page).not_to have_content('Allows commits from members who can merge to the target branch')
......
......@@ -302,7 +302,7 @@ describe 'Merge request > User sees merge widget', :js do
visit project_merge_request_path(project_only_mwps, merge_request_in_only_mwps_project)
end
it 'should be allowed to merge' do
it 'is allowed to merge' do
# Wait for the `ci_status` and `merge_check` requests
wait_for_requests
......
......@@ -230,7 +230,7 @@ describe 'Merge request > User sees versions', :js do
wait_for_requests
end
it 'should only show diffs from the commit' do
it 'only shows diffs from the commit' do
diff_commit_ids = find_all('.diff-file [data-commit-id]').map {|diff| diff['data-commit-id']}
expect(diff_commit_ids).not_to be_empty
......
......@@ -572,7 +572,7 @@ describe 'File blob', :js do
visit_blob('files/ruby/test.rb', ref: 'feature')
end
it 'should show the realtime pipeline status' do
it 'shows the realtime pipeline status' do
page.within('.commit-actions') do
expect(page).to have_css('.ci-status-icon')
expect(page).to have_css('.ci-status-icon-running')
......
......@@ -80,7 +80,7 @@ describe 'Clusters Applications', :js do
context 'on an abac cluster' do
let(:cluster) { create(:cluster, :provided_by_gcp, :rbac_disabled, projects: [project]) }
it 'should show info block and not be installable' do
it 'shows info block and not be installable' do
page.within('.js-cluster-application-row-knative') do
expect(page).to have_css('.rbac-notice')
expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to eq('true')
......@@ -91,7 +91,7 @@ describe 'Clusters Applications', :js do
context 'on an rbac cluster' do
let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
it 'should not show callout block and be installable' do
it 'does not show callout block and be installable' do
page.within('.js-cluster-application-row-knative') do
expect(page).not_to have_css('.rbac-notice')
expect(page).to have_css('.js-cluster-application-install-button:not([disabled])')
......
......@@ -43,7 +43,7 @@ describe 'Mini Pipeline Graph in Commit View', :js do
visit project_commit_path(project, project.commit.id)
end
it 'should not display a mini pipeline graph' do
it 'does not display a mini pipeline graph' do
expect(page).not_to have_selector('.mr-widget-pipeline-graph')
end
end
......
......@@ -159,7 +159,7 @@ describe 'Environment' do
context 'for project maintainer' do
let(:role) { :maintainer }
it 'it shows the terminal button' do
it 'shows the terminal button' do
expect(page).to have_terminal_button
end
......
......@@ -30,7 +30,7 @@ describe 'Environments page', :js do
end
describe 'in available tab page' do
it 'should show one environment' do
it 'shows one environment' do
visit_environments(project, scope: 'available')
expect(page).to have_css('.environments-container')
......@@ -44,7 +44,7 @@ describe 'Environments page', :js do
create_list(:environment, 4, project: project, state: :available)
end
it 'should render second page of pipelines' do
it 'renders second page of pipelines' do
visit_environments(project, scope: 'available')
find('.js-next-button').click
......@@ -56,7 +56,7 @@ describe 'Environments page', :js do
end
describe 'in stopped tab page' do
it 'should show no environments' do
it 'shows no environments' do
visit_environments(project, scope: 'stopped')
expect(page).to have_css('.environments-container')
......@@ -72,7 +72,7 @@ describe 'Environments page', :js do
allow_any_instance_of(Kubeclient::Client).to receive(:proxy_url).and_raise(Kubeclient::HttpError.new(401, 'Unauthorized', nil))
end
it 'should show one environment without error' do
it 'shows one environment without error' do
visit_environments(project, scope: 'available')
expect(page).to have_css('.environments-container')
......@@ -87,7 +87,7 @@ describe 'Environments page', :js do
end
describe 'in available tab page' do
it 'should show no environments' do
it 'shows no environments' do
visit_environments(project, scope: 'available')
expect(page).to have_css('.environments-container')
......@@ -96,7 +96,7 @@ describe 'Environments page', :js do
end
describe 'in stopped tab page' do
it 'should show one environment' do
it 'shows one environment' do
visit_environments(project, scope: 'stopped')
expect(page).to have_css('.environments-container')
......
......@@ -159,7 +159,7 @@ describe 'Project > Members > Invite group', :js do
open_select2 '#link_group_id'
end
it 'should infinitely scroll' do
it 'infinitely scrolls' do
expect(find('.select2-drop .select2-results')).to have_selector('.select2-result', count: 1)
scroll_select2_to_bottom('.select2-drop .select2-results:visible')
......
......@@ -93,14 +93,14 @@ describe 'Pipeline Schedules', :js do
expect(page).to have_button('UTC')
end
it 'it creates a new scheduled pipeline' do
it 'creates a new scheduled pipeline' do
fill_in_schedule_form
save_pipeline_schedule
expect(page).to have_content('my fancy description')
end
it 'it prevents an invalid form from being submitted' do
it 'prevents an invalid form from being submitted' do
save_pipeline_schedule
expect(page).to have_content('This field is required')
......@@ -112,7 +112,7 @@ describe 'Pipeline Schedules', :js do
edit_pipeline_schedule
end
it 'it displays existing properties' do
it 'displays existing properties' do
description = find_field('schedule_description').value
expect(description).to eq('pipeline schedule')
expect(page).to have_button('master')
......
......@@ -154,7 +154,7 @@ describe 'Pipeline', :js do
end
end
it 'should be possible to retry the success job' do
it 'is possible to retry the success job' do
find('#ci-badge-build .ci-action-icon-container').click
expect(page).not_to have_content('Retry job')
......@@ -194,13 +194,13 @@ describe 'Pipeline', :js do
end
end
it 'should be possible to retry the failed build' do
it 'is possible to retry the failed build' do
find('#ci-badge-test .ci-action-icon-container').click
expect(page).not_to have_content('Retry job')
end
it 'should include the failure reason' do
it 'includes the failure reason' do
page.within('#ci-badge-test') do
build_link = page.find('.js-pipeline-graph-job-link')
expect(build_link['data-original-title']).to eq('test - failed - (unknown failure)')
......@@ -220,7 +220,7 @@ describe 'Pipeline', :js do
end
end
it 'should be possible to play the manual job' do
it 'is possible to play the manual job' do
find('#ci-badge-manual-build .ci-action-icon-container').click
expect(page).not_to have_content('Play job')
......@@ -454,7 +454,7 @@ describe 'Pipeline', :js do
expect(page).to have_content('Cancel running')
end
it 'should not link to job' do
it 'does not link to job' do
expect(page).not_to have_selector('.js-pipeline-graph-job-link')
end
end
......
......@@ -542,19 +542,19 @@ describe 'Pipelines', :js do
visit_project_pipelines
end
it 'should render a mini pipeline graph' do
it 'renders a mini pipeline graph' do
expect(page).to have_selector('.js-mini-pipeline-graph')
expect(page).to have_selector('.js-builds-dropdown-button')
end
context 'when clicking a stage badge' do
it 'should open a dropdown' do
it 'opens a dropdown' do
find('.js-builds-dropdown-button').click
expect(page).to have_link build.name
end
it 'should be possible to cancel pending build' do
it 'is possible to cancel pending build' do
find('.js-builds-dropdown-button').click
find('.js-ci-action').click
wait_for_requests
......@@ -570,7 +570,7 @@ describe 'Pipelines', :js do
name: 'build')
end
it 'should display the failure reason' do
it 'displays the failure reason' do
find('.js-builds-dropdown-button').click
within('.js-builds-dropdown-list') do
......@@ -587,21 +587,21 @@ describe 'Pipelines', :js do
create(:ci_empty_pipeline, project: project)
end
it 'should render pagination' do
it 'renders pagination' do
visit project_pipelines_path(project)
wait_for_requests
expect(page).to have_selector('.gl-pagination')
end
it 'should render second page of pipelines' do
it 'renders second page of pipelines' do
visit project_pipelines_path(project, page: '2')
wait_for_requests
expect(page).to have_selector('.gl-pagination .page', count: 2)
end
it 'should show updated content' do
it 'shows updated content' do
visit project_pipelines_path(project)
wait_for_requests
page.find('.js-next-button .page-link').click
......
......@@ -23,14 +23,14 @@ describe 'Projects > Snippets > User comments on a snippet', :js do
expect(page).to have_content('Good snippet!')
end
it 'should have autocomplete' do
it 'has autocomplete' do
find('#note_note').native.send_keys('')
fill_in 'note[note]', with: '@'
expect(page).to have_selector('.atwho-view')
end
it 'should have zen mode' do
it 'has zen mode' do
find('.js-zen-enter').click
expect(page).to have_selector('.fullscreen')
end
......
......@@ -3,13 +3,13 @@ require 'spec_helper'
describe 'RavenJS' do
let(:raven_path) { '/raven.chunk.js' }
it 'should not load raven if sentry is disabled' do
it 'does not load raven if sentry is disabled' do
visit new_user_session_path
expect(has_requested_raven).to eq(false)
end
it 'should load raven if sentry is enabled' do
it 'loads raven if sentry is enabled' do
stub_application_setting(clientside_sentry_dsn: 'https://key@domain.com/id', clientside_sentry_enabled: true)
visit new_user_session_path
......
......@@ -83,7 +83,7 @@ describe 'Comments on personal snippets', :js do
expect(find('div#notes')).to have_content('This is awesome!')
end
it 'should not have autocomplete' do
it 'does not have autocomplete' do
wait_for_requests
find('#note_note').native.send_keys('')
......
......@@ -93,7 +93,7 @@ describe 'Overview tab on a user profile', :js do
describe 'user has no personal projects' do
include_context 'visit overview tab'
it 'it shows an empty project list with an info message' do
it 'shows an empty project list with an info message' do
page.within('.projects-block') do
expect(page).to have_selector('.loading', visible: false)
expect(page).to have_content('You haven\'t created any personal projects.')
......@@ -113,7 +113,7 @@ describe 'Overview tab on a user profile', :js do
include_context 'visit overview tab'
it 'it shows one entry in the list of projects' do
it 'shows one entry in the list of projects' do
page.within('.projects-block') do
expect(page).to have_selector('.project-row', count: 1)
end
......@@ -139,7 +139,7 @@ describe 'Overview tab on a user profile', :js do
include_context 'visit overview tab'
it 'it shows max. ten entries in the list of projects' do
it 'shows max. ten entries in the list of projects' do
page.within('.projects-block') do
expect(page).to have_selector('.project-row', count: 10)
end
......
......@@ -719,7 +719,7 @@ describe IssuesFinder do
end
end
describe '#use_subquery_for_search?' do
describe '#use_cte_for_search?' do
let(:finder) { described_class.new(nil, params) }
before do
......@@ -731,7 +731,7 @@ describe IssuesFinder do
let(:params) { { attempt_group_search_optimizations: true } }
it 'returns false' do
expect(finder.use_subquery_for_search?).to be_falsey
expect(finder.use_cte_for_search?).to be_falsey
end
end
......@@ -743,15 +743,15 @@ describe IssuesFinder do
end
it 'returns false' do
expect(finder.use_subquery_for_search?).to be_falsey
expect(finder.use_cte_for_search?).to be_falsey
end
end
context 'when the attempt_group_search_optimizations param is falsey' do
context 'when the force_cte param is falsey' do
let(:params) { { search: 'foo' } }
it 'returns false' do
expect(finder.use_subquery_for_search?).to be_falsey
expect(finder.use_cte_for_search?).to be_falsey
end
end
......@@ -763,80 +763,39 @@ describe IssuesFinder do
end
it 'returns false' do
expect(finder.use_subquery_for_search?).to be_falsey
expect(finder.use_cte_for_search?).to be_falsey
end
end
context 'when force_cte? is true' do
let(:params) { { search: 'foo', attempt_group_search_optimizations: true, force_cte: true } }
it 'returns false' do
expect(finder.use_subquery_for_search?).to be_falsey
end
end
context 'when all conditions are met' do
let(:params) { { search: 'foo', attempt_group_search_optimizations: true } }
it 'returns true' do
expect(finder.use_subquery_for_search?).to be_truthy
end
end
end
context 'when attempt_group_search_optimizations is unset and attempt_project_search_optimizations is set' do
let(:params) { { search: 'foo', attempt_project_search_optimizations: true } }
describe '#use_cte_for_count?' do
let(:finder) { described_class.new(nil, params) }
before do
allow(Gitlab::Database).to receive(:postgresql?).and_return(true)
stub_feature_flags(attempt_group_search_optimizations: true)
end
context 'when there is no search param' do
let(:params) { { attempt_group_search_optimizations: true, force_cte: true } }
it 'returns false' do
expect(finder.use_cte_for_count?).to be_falsey
end
end
context 'when the database is not Postgres' do
let(:params) { { search: 'foo', force_cte: true, attempt_group_search_optimizations: true } }
before do
allow(Gitlab::Database).to receive(:postgresql?).and_return(false)
end
it 'returns false' do
expect(finder.use_cte_for_count?).to be_falsey
end
end
context 'when the force_cte param is falsey' do
let(:params) { { search: 'foo' } }
context 'and the corresponding feature flag is disabled' do
before do
stub_feature_flags(attempt_project_search_optimizations: false)
end
it 'returns false' do
expect(finder.use_cte_for_count?).to be_falsey
it 'returns false' do
expect(finder.use_cte_for_search?).to be_falsey
end
end
end
context 'when the attempt_group_search_optimizations flag is disabled' do
let(:params) { { search: 'foo', force_cte: true, attempt_group_search_optimizations: true } }
before do
stub_feature_flags(attempt_group_search_optimizations: false)
end
context 'and the corresponding feature flag is enabled' do
before do
stub_feature_flags(attempt_project_search_optimizations: true)
end
it 'returns false' do
expect(finder.use_cte_for_count?).to be_falsey
it 'returns true' do
expect(finder.use_cte_for_search?).to be_truthy
end
end
end
context 'when all conditions are met' do
let(:params) { { search: 'foo', force_cte: true, attempt_group_search_optimizations: true } }
let(:params) { { search: 'foo', attempt_group_search_optimizations: true } }
it 'returns true' do
expect(finder.use_cte_for_count?).to be_truthy
expect(finder.use_cte_for_search?).to be_truthy
end
end
end
......
......@@ -9,7 +9,7 @@ describe MilestonesFinder do
let!(:milestone_3) { create(:milestone, project: project_1, state: 'active', due_date: Date.tomorrow) }
let!(:milestone_4) { create(:milestone, project: project_2, state: 'active') }
it 'it returns milestones for projects' do
it 'returns milestones for projects' do
result = described_class.new(project_ids: [project_1.id, project_2.id], state: 'all').execute
expect(result).to contain_exactly(milestone_3, milestone_4)
......
......@@ -59,19 +59,19 @@ describe IconsHelper do
describe 'non existing icon' do
non_existing = 'non_existing_icon_sprite'
it 'should raise in development mode' do
it 'raises in development mode' do
allow(Rails.env).to receive(:development?).and_return(true)
expect { sprite_icon(non_existing) }.to raise_error(ArgumentError, /is not a known icon/)
end
it 'should raise in test mode' do
it 'raises in test mode' do
allow(Rails.env).to receive(:test?).and_return(true)
expect { sprite_icon(non_existing) }.to raise_error(ArgumentError, /is not a known icon/)
end
it 'should not raise in production mode' do
it 'does not raise in production mode' do
allow(Rails.env).to receive(:test?).and_return(false)
allow(Rails.env).to receive(:development?).and_return(false)
......
......@@ -12,7 +12,7 @@ describe SearchHelper do
allow(self).to receive(:current_user).and_return(nil)
end
it "it returns nil" do
it "returns nil" do
expect(search_autocomplete_opts("q")).to be_nil
end
end
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe VersionCheckHelper do
describe '#version_status_badge' do
it 'should return nil if not dev environment and not enabled' do
it 'returns nil if not dev environment and not enabled' do
allow(Rails.env).to receive(:production?) { false }
allow(Gitlab::CurrentSettings.current_application_settings).to receive(:version_check_enabled) { false }
......@@ -16,16 +16,16 @@ describe VersionCheckHelper do
allow(VersionCheck).to receive(:url) { 'https://version.host.com/check.svg?gitlab_info=xxx' }
end
it 'should return an image tag' do
it 'returns an image tag' do
expect(helper.version_status_badge).to start_with('<img')
end
it 'should have a js prefixed css class' do
it 'has a js prefixed css class' do
expect(helper.version_status_badge)
.to match(/class="js-version-status-badge lazy"/)
end
it 'should have a VersionCheck url as the src' do
it 'has a VersionCheck url as the src' do
expect(helper.version_status_badge)
.to include(%{src="https://version.host.com/check.svg?gitlab_info=xxx"})
end
......
......@@ -21,7 +21,7 @@ describe API::Helpers::CustomValidators do
end
context 'invalid parameters' do
it 'should raise a validation error' do
it 'raises a validation error' do
expect_validation_error({ 'test' => 'some_value' })
end
end
......@@ -44,7 +44,7 @@ describe API::Helpers::CustomValidators do
end
context 'invalid parameters' do
it 'should raise a validation error' do
it 'raises a validation error' do
expect_validation_error({ 'test' => 'some_other_string' })
end
end
......@@ -67,7 +67,7 @@ describe API::Helpers::CustomValidators do
end
context 'invalid parameters' do
it 'should raise a validation error' do
it 'raises a validation error' do
expect_validation_error({ 'test' => 'some_other_string' })
end
end
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Banzai::Filter::PlantumlFilter do
include FilterSpecHelper
it 'should replace plantuml pre tag with img tag' do
it 'replaces plantuml pre tag with img tag' do
stub_application_setting(plantuml_enabled: true, plantuml_url: "http://localhost:8080")
input = '<pre><code lang="plantuml">Bob -> Sara : Hello</code></pre>'
output = '<div class="imageblock"><div class="content"><img class="plantuml" src="http://localhost:8080/png/U9npoazIqBLJ24uiIbImKl18pSd91m0rkGMq"></div></div>'
......@@ -12,7 +12,7 @@ describe Banzai::Filter::PlantumlFilter do
expect(doc.to_s).to eq output
end
it 'should not replace plantuml pre tag with img tag if disabled' do
it 'does not replace plantuml pre tag with img tag if disabled' do
stub_application_setting(plantuml_enabled: false)
input = '<pre><code lang="plantuml">Bob -> Sara : Hello</code></pre>'
output = '<pre><code lang="plantuml">Bob -&gt; Sara : Hello</code></pre>'
......@@ -21,7 +21,7 @@ describe Banzai::Filter::PlantumlFilter do
expect(doc.to_s).to eq output
end
it 'should not replace plantuml pre tag with img tag if url is invalid' do
it 'does not replace plantuml pre tag with img tag if url is invalid' do
stub_application_setting(plantuml_enabled: true, plantuml_url: "invalid")
input = '<pre><code lang="plantuml">Bob -> Sara : Hello</code></pre>'
output = '<div class="listingblock"><div class="content"><pre class="plantuml plantuml-error"> PlantUML Error: cannot connect to PlantUML server at "invalid"</pre></div></div>'
......
......@@ -5,7 +5,7 @@ describe Forever do
subject { described_class.date }
context 'when using PostgreSQL' do
it 'should return Postgresql future date' do
it 'returns Postgresql future date' do
allow(Gitlab::Database).to receive(:postgresql?).and_return(true)
expect(subject).to eq(described_class::POSTGRESQL_DATE)
......@@ -13,7 +13,7 @@ describe Forever do
end
context 'when using MySQL' do
it 'should return MySQL future date' do
it 'returns MySQL future date' do
allow(Gitlab::Database).to receive(:postgresql?).and_return(false)
expect(subject).to eq(described_class::MYSQL_DATE)
......
......@@ -19,7 +19,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, :
end
shared_examples 'consistent kubernetes namespace attributes' do
it 'should populate namespace and service account information' do
it 'populates namespace and service account information' do
migration.perform
clusters_with_namespace.each do |cluster|
......@@ -41,7 +41,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, :
context 'when no Clusters::Project has a Clusters::KubernetesNamespace' do
let(:cluster_projects) { cluster_projects_table.all }
it 'should create a Clusters::KubernetesNamespace per Clusters::Project' do
it 'creates a Clusters::KubernetesNamespace per Clusters::Project' do
expect do
migration.perform
end.to change(Clusters::KubernetesNamespace, :count).by(cluster_projects_table.count)
......@@ -57,7 +57,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, :
create_kubernetes_namespace(clusters_table.all)
end
it 'should not create any Clusters::KubernetesNamespace' do
it 'does not create any Clusters::KubernetesNamespace' do
expect do
migration.perform
end.not_to change(Clusters::KubernetesNamespace, :count)
......@@ -78,7 +78,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, :
end.to change(Clusters::KubernetesNamespace, :count).by(with_no_kubernetes_namespace.count)
end
it 'should not modify clusters with Clusters::KubernetesNamespace' do
it 'does not modify clusters with Clusters::KubernetesNamespace' do
migration.perform
with_kubernetes_namespace.each do |cluster|
......
......@@ -41,7 +41,7 @@ describe Gitlab::BackgroundMigration::PopulateForkNetworksRange, :migration, sch
migration.perform(1, 3)
end
it 'it creates the fork network' do
it 'creates the fork network' do
expect(fork_network1).not_to be_nil
expect(fork_network2).not_to be_nil
end
......
......@@ -26,7 +26,7 @@ describe Gitlab::Ci::Config::External::File::Base do
context 'when a location is present' do
let(:location) { 'some-location' }
it 'should return true' do
it 'returns true' do
expect(subject).to be_matching
end
end
......@@ -34,7 +34,7 @@ describe Gitlab::Ci::Config::External::File::Base do
context 'with a location is missing' do
let(:location) { nil }
it 'should return false' do
it 'returns false' do
expect(subject).not_to be_matching
end
end
......
......@@ -15,7 +15,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'when a local is specified' do
let(:params) { { local: 'file' } }
it 'should return true' do
it 'returns true' do
expect(local_file).to be_matching
end
end
......@@ -23,7 +23,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'with a missing local' do
let(:params) { { local: nil } }
it 'should return false' do
it 'returns false' do
expect(local_file).not_to be_matching
end
end
......@@ -31,7 +31,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'with a missing local key' do
let(:params) { {} }
it 'should return false' do
it 'returns false' do
expect(local_file).not_to be_matching
end
end
......@@ -45,7 +45,7 @@ describe Gitlab::Ci::Config::External::File::Local do
allow_any_instance_of(described_class).to receive(:fetch_local_content).and_return("image: 'ruby2:2'")
end
it 'should return true' do
it 'returns true' do
expect(local_file.valid?).to be_truthy
end
end
......@@ -53,7 +53,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'when is not a valid local path' do
let(:location) { '/lib/gitlab/ci/templates/non-existent-file.yml' }
it 'should return false' do
it 'returns false' do
expect(local_file.valid?).to be_falsy
end
end
......@@ -61,7 +61,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'when is not a yaml file' do
let(:location) { '/config/application.rb' }
it 'should return false' do
it 'returns false' do
expect(local_file.valid?).to be_falsy
end
end
......@@ -84,7 +84,7 @@ describe Gitlab::Ci::Config::External::File::Local do
allow_any_instance_of(described_class).to receive(:fetch_local_content).and_return(local_file_content)
end
it 'should return the content of the file' do
it 'returns the content of the file' do
expect(local_file.content).to eq(local_file_content)
end
end
......@@ -92,7 +92,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'with an invalid file' do
let(:location) { '/lib/gitlab/ci/templates/non-existent-file.yml' }
it 'should be nil' do
it 'is nil' do
expect(local_file.content).to be_nil
end
end
......@@ -101,7 +101,7 @@ describe Gitlab::Ci::Config::External::File::Local do
describe '#error_message' do
let(:location) { '/lib/gitlab/ci/templates/non-existent-file.yml' }
it 'should return an error message' do
it 'returns an error message' do
expect(local_file.error_message).to eq("Local file `#{location}` does not exist!")
end
end
......
......@@ -19,7 +19,7 @@ describe Gitlab::Ci::Config::External::File::Project do
context 'when a file and project is specified' do
let(:params) { { file: 'file.yml', project: 'project' } }
it 'should return true' do
it 'returns true' do
expect(project_file).to be_matching
end
end
......@@ -27,7 +27,7 @@ describe Gitlab::Ci::Config::External::File::Project do
context 'with only file is specified' do
let(:params) { { file: 'file.yml' } }
it 'should return false' do
it 'returns false' do
expect(project_file).not_to be_matching
end
end
......@@ -35,7 +35,7 @@ describe Gitlab::Ci::Config::External::File::Project do
context 'with only project is specified' do
let(:params) { { project: 'project' } }
it 'should return false' do
it 'returns false' do
expect(project_file).not_to be_matching
end
end
......@@ -43,7 +43,7 @@ describe Gitlab::Ci::Config::External::File::Project do
context 'with a missing local key' do
let(:params) { {} }
it 'should return false' do
it 'returns false' do
expect(project_file).not_to be_matching
end
end
......@@ -61,14 +61,14 @@ describe Gitlab::Ci::Config::External::File::Project do
stub_project_blob(root_ref_sha, '/file.yml') { 'image: ruby:2.1' }
end
it 'should return true' do
it 'returns true' do
expect(project_file).to be_valid
end
context 'when user does not have permission to access file' do
let(:context_user) { create(:user) }
it 'should return false' do
it 'returns false' do
expect(project_file).not_to be_valid
expect(project_file.error_message).to include("Project `#{project.full_path}` not found or access denied!")
end
......@@ -86,7 +86,7 @@ describe Gitlab::Ci::Config::External::File::Project do
stub_project_blob(ref_sha, '/file.yml') { 'image: ruby:2.1' }
end
it 'should return true' do
it 'returns true' do
expect(project_file).to be_valid
end
end
......@@ -102,7 +102,7 @@ describe Gitlab::Ci::Config::External::File::Project do
stub_project_blob(root_ref_sha, '/file.yml') { '' }
end
it 'should return false' do
it 'returns false' do
expect(project_file).not_to be_valid
expect(project_file.error_message).to include("Project `#{project.full_path}` file `/file.yml` is empty!")
end
......@@ -113,7 +113,7 @@ describe Gitlab::Ci::Config::External::File::Project do
{ project: project.full_path, ref: 'I-Do-Not-Exist', file: '/file.yml' }
end
it 'should return false' do
it 'returns false' do
expect(project_file).not_to be_valid
expect(project_file.error_message).to include("Project `#{project.full_path}` reference `I-Do-Not-Exist` does not exist!")
end
......@@ -124,7 +124,7 @@ describe Gitlab::Ci::Config::External::File::Project do
{ project: project.full_path, file: '/invalid-file.yml' }
end
it 'should return false' do
it 'returns false' do
expect(project_file).not_to be_valid
expect(project_file.error_message).to include("Project `#{project.full_path}` file `/invalid-file.yml` does not exist!")
end
......@@ -135,7 +135,7 @@ describe Gitlab::Ci::Config::External::File::Project do
{ project: project.full_path, file: '/invalid-file' }
end
it 'should return false' do
it 'returns false' do
expect(project_file).not_to be_valid
expect(project_file.error_message).to include('Included file `/invalid-file` does not have YAML extension!')
end
......
......@@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'when a remote is specified' do
let(:params) { { remote: 'http://remote' } }
it 'should return true' do
it 'returns true' do
expect(remote_file).to be_matching
end
end
......@@ -29,7 +29,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'with a missing remote' do
let(:params) { { remote: nil } }
it 'should return false' do
it 'returns false' do
expect(remote_file).not_to be_matching
end
end
......@@ -37,7 +37,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'with a missing remote key' do
let(:params) { {} }
it 'should return false' do
it 'returns false' do
expect(remote_file).not_to be_matching
end
end
......@@ -49,7 +49,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_return(body: remote_file_content)
end
it 'should return true' do
it 'returns true' do
expect(remote_file.valid?).to be_truthy
end
end
......@@ -57,7 +57,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'with an irregular url' do
let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' }
it 'should return false' do
it 'returns false' do
expect(remote_file.valid?).to be_falsy
end
end
......@@ -67,7 +67,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
allow(Gitlab::HTTP).to receive(:get).and_raise(Timeout::Error)
end
it 'should be falsy' do
it 'is falsy' do
expect(remote_file.valid?).to be_falsy
end
end
......@@ -75,7 +75,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'when is not a yaml file' do
let(:location) { 'https://asdasdasdaj48ggerexample.com' }
it 'should be falsy' do
it 'is falsy' do
expect(remote_file.valid?).to be_falsy
end
end
......@@ -83,7 +83,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'with an internal url' do
let(:location) { 'http://localhost:8080' }
it 'should be falsy' do
it 'is falsy' do
expect(remote_file.valid?).to be_falsy
end
end
......@@ -95,7 +95,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_return(body: remote_file_content)
end
it 'should return the content of the file' do
it 'returns the content of the file' do
expect(remote_file.content).to eql(remote_file_content)
end
end
......@@ -105,7 +105,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
allow(Gitlab::HTTP).to receive(:get).and_raise(Timeout::Error)
end
it 'should be falsy' do
it 'is falsy' do
expect(remote_file.content).to be_falsy
end
end
......@@ -117,7 +117,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_raise(SocketError.new('Some HTTP error'))
end
it 'should be nil' do
it 'is nil' do
expect(remote_file.content).to be_nil
end
end
......@@ -125,7 +125,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'with an internal url' do
let(:location) { 'http://localhost:8080' }
it 'should be nil' do
it 'is nil' do
expect(remote_file.content).to be_nil
end
end
......@@ -147,7 +147,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_timeout
end
it 'should returns error message about a timeout' do
it 'returns error message about a timeout' do
expect(subject).to match /could not be fetched because of a timeout error!/
end
end
......@@ -157,7 +157,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_raise(Gitlab::HTTP::Error)
end
it 'should returns error message about a HTTP error' do
it 'returns error message about a HTTP error' do
expect(subject).to match /could not be fetched because of HTTP error!/
end
end
......@@ -167,7 +167,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_return(body: remote_file_content, status: 404)
end
it 'should returns error message about a timeout' do
it 'returns error message about a timeout' do
expect(subject).to match /could not be fetched because of HTTP code `404` error!/
end
end
......@@ -175,7 +175,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'when the URL is blocked' do
let(:location) { 'http://127.0.0.1/some/path/to/config.yaml' }
it 'should include details about blocked URL' do
it 'includes details about blocked URL' do
expect(subject).to eq "Remote file could not be fetched because URL '#{location}' " \
'is blocked: Requests to localhost are not allowed!'
end
......
......@@ -16,7 +16,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'when a template is specified' do
let(:params) { { template: 'some-template' } }
it 'should return true' do
it 'returns true' do
expect(template_file).to be_matching
end
end
......@@ -24,7 +24,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'with a missing template' do
let(:params) { { template: nil } }
it 'should return false' do
it 'returns false' do
expect(template_file).not_to be_matching
end
end
......@@ -32,7 +32,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'with a missing template key' do
let(:params) { {} }
it 'should return false' do
it 'returns false' do
expect(template_file).not_to be_matching
end
end
......@@ -42,7 +42,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'when is a valid template name' do
let(:template) { 'Auto-DevOps.gitlab-ci.yml' }
it 'should return true' do
it 'returns true' do
expect(template_file).to be_valid
end
end
......@@ -50,7 +50,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'with invalid template name' do
let(:template) { 'Template.yml' }
it 'should return false' do
it 'returns false' do
expect(template_file).not_to be_valid
expect(template_file.error_message).to include('Template file `Template.yml` is not a valid location!')
end
......@@ -59,7 +59,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'with a non-existing template' do
let(:template) { 'I-Do-Not-Have-This-Template.gitlab-ci.yml' }
it 'should return false' do
it 'returns false' do
expect(template_file).not_to be_valid
expect(template_file.error_message).to include('Included file `I-Do-Not-Have-This-Template.gitlab-ci.yml` is empty or does not exist!')
end
......
......@@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::External::Processor do
context 'when no external files defined' do
let(:values) { { image: 'ruby:2.2' } }
it 'should return the same values' do
it 'returns the same values' do
expect(processor.perform).to eq(values)
end
end
......@@ -29,7 +29,7 @@ describe Gitlab::Ci::Config::External::Processor do
context 'when an invalid local file is defined' do
let(:values) { { include: '/lib/gitlab/ci/templates/non-existent-file.yml', image: 'ruby:2.2' } }
it 'should raise an error' do
it 'raises an error' do
expect { processor.perform }.to raise_error(
described_class::IncludeError,
"Local file `/lib/gitlab/ci/templates/non-existent-file.yml` does not exist!"
......@@ -45,7 +45,7 @@ describe Gitlab::Ci::Config::External::Processor do
WebMock.stub_request(:get, remote_file).to_raise(SocketError.new('Some HTTP error'))
end
it 'should raise an error' do
it 'raises an error' do
expect { processor.perform }.to raise_error(
described_class::IncludeError,
"Remote file `#{remote_file}` could not be fetched because of a socket error!"
......@@ -78,12 +78,12 @@ describe Gitlab::Ci::Config::External::Processor do
WebMock.stub_request(:get, remote_file).to_return(body: external_file_content)
end
it 'should append the file to the values' do
it 'appends the file to the values' do
output = processor.perform
expect(output.keys).to match_array([:image, :before_script, :rspec, :rubocop])
end
it "should remove the 'include' keyword" do
it "removes the 'include' keyword" do
expect(processor.perform[:include]).to be_nil
end
end
......@@ -105,12 +105,12 @@ describe Gitlab::Ci::Config::External::Processor do
.to receive(:fetch_local_content).and_return(local_file_content)
end
it 'should append the file to the values' do
it 'appends the file to the values' do
output = processor.perform
expect(output.keys).to match_array([:image, :before_script])
end
it "should remove the 'include' keyword" do
it "removes the 'include' keyword" do
expect(processor.perform[:include]).to be_nil
end
end
......@@ -148,11 +148,11 @@ describe Gitlab::Ci::Config::External::Processor do
WebMock.stub_request(:get, remote_file).to_return(body: remote_file_content)
end
it 'should append the files to the values' do
it 'appends the files to the values' do
expect(processor.perform.keys).to match_array([:image, :stages, :before_script, :rspec])
end
it "should remove the 'include' keyword" do
it "removes the 'include' keyword" do
expect(processor.perform[:include]).to be_nil
end
end
......@@ -167,7 +167,7 @@ describe Gitlab::Ci::Config::External::Processor do
.to receive(:fetch_local_content).and_return(local_file_content)
end
it 'should raise an error' do
it 'raises an error' do
expect { processor.perform }.to raise_error(
described_class::IncludeError,
"Included file `/lib/gitlab/ci/templates/template.yml` does not have valid YAML syntax!"
......@@ -190,7 +190,7 @@ describe Gitlab::Ci::Config::External::Processor do
HEREDOC
end
it 'should take precedence' do
it 'takes precedence' do
WebMock.stub_request(:get, remote_file).to_return(body: remote_file_content)
expect(processor.perform[:image]).to eq('ruby:2.2')
end
......
......@@ -225,7 +225,7 @@ describe Gitlab::Ci::Config do
end
context "when gitlab_ci_yml has valid 'include' defined" do
it 'should return a composed hash' do
it 'returns a composed hash' do
before_script_values = [
"apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs", "ruby -v",
"which ruby",
......@@ -316,7 +316,7 @@ describe Gitlab::Ci::Config do
HEREDOC
end
it 'should take precedence' do
it 'takes precedence' do
expect(config.to_hash).to eq({ image: 'ruby:2.2' })
end
end
......@@ -341,7 +341,7 @@ describe Gitlab::Ci::Config do
HEREDOC
end
it 'should merge the variables dictionaries' do
it 'merges the variables dictionaries' do
expect(config.to_hash).to eq({ variables: { A: 'alpha', B: 'beta', C: 'gamma', D: 'delta' } })
end
end
......
......@@ -23,7 +23,7 @@ describe Gitlab::Ci::Pipeline::Chain::Skip do
step.perform!
end
it 'should break the chain' do
it 'breaks the chain' do
expect(step.break?).to be true
end
......@@ -37,11 +37,11 @@ describe Gitlab::Ci::Pipeline::Chain::Skip do
step.perform!
end
it 'should not break the chain' do
it 'does not break the chain' do
expect(step.break?).to be false
end
it 'should not skip a pipeline chain' do
it 'does not skip a pipeline chain' do
expect(pipeline.reload).not_to be_skipped
end
end
......
......@@ -150,13 +150,13 @@ describe Gitlab::ContributionsCalendar do
end
describe '#starting_year' do
it "should be the start of last year" do
it "is the start of last year" do
expect(calendar.starting_year).to eq(last_year.year)
end
end
describe '#starting_month' do
it "should be the start of this month" do
it "is the start of this month" do
expect(calendar.starting_month).to eq(today.month)
end
end
......
......@@ -27,7 +27,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1, :delete do
describe '#rename_wildcard_paths' do
it_behaves_like 'renames child namespaces'
it 'should rename projects' do
it 'renames projects' do
rename_projects = double
expect(described_class::RenameProjects)
.to receive(:new).with(['the-path'], subject)
......@@ -40,7 +40,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1, :delete do
end
describe '#rename_root_paths' do
it 'should rename namespaces' do
it 'renames namespaces' do
rename_namespaces = double
expect(described_class::RenameNamespaces)
.to receive(:new).with(['the-path'], subject)
......
......@@ -27,7 +27,7 @@ describe Gitlab::Diff::FileCollection::MergeRequestDiff do
let(:diffable) { merge_request.merge_request_diff }
end
it 'it uses a different cache key if diff line keys change' do
it 'uses a different cache key if diff line keys change' do
mr_diff = described_class.new(merge_request.merge_request_diff, diff_options: nil)
key = mr_diff.cache_key
......
......@@ -113,13 +113,13 @@ describe Gitlab::Git::Commit, :seed_helper do
context 'Class methods' do
shared_examples '.find' do
it "should return first head commit if without params" do
it "returns first head commit if without params" do
expect(described_class.last(repository).id).to eq(
rugged_repo.head.target.oid
)
end
it "should return valid commit" do
it "returns valid commit" do
expect(described_class.find(repository, SeedRepo::Commit::ID)).to be_valid_commit
end
......@@ -127,21 +127,21 @@ describe Gitlab::Git::Commit, :seed_helper do
expect(described_class.find(repository, SeedRepo::Commit::ID).parent_ids).to be_an(Array)
end
it "should return valid commit for tag" do
it "returns valid commit for tag" do
expect(described_class.find(repository, 'v1.0.0').id).to eq('6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9')
end
it "should return nil for non-commit ids" do
it "returns nil for non-commit ids" do
blob = Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "files/ruby/popen.rb")
expect(described_class.find(repository, blob.id)).to be_nil
end
it "should return nil for parent of non-commit object" do
it "returns nil for parent of non-commit object" do
blob = Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "files/ruby/popen.rb")
expect(described_class.find(repository, "#{blob.id}^")).to be_nil
end
it "should return nil for nonexisting ids" do
it "returns nil for nonexisting ids" do
expect(described_class.find(repository, "+123_4532530XYZ")).to be_nil
end
......@@ -328,7 +328,7 @@ describe Gitlab::Git::Commit, :seed_helper do
end
describe '.find_all' do
it 'should return a return a collection of commits' do
it 'returns a return a collection of commits' do
commits = described_class.find_all(repository)
expect(commits).to all( be_a_kind_of(described_class) )
......
......@@ -182,7 +182,7 @@ EOT
context "without default options" do
let(:filtered_options) { described_class.filter_diff_options(options) }
it "should filter invalid options" do
it "filters invalid options" do
expect(filtered_options).not_to have_key(:invalid_opt)
end
end
......@@ -193,16 +193,16 @@ EOT
described_class.filter_diff_options(options, default_options)
end
it "should filter invalid options" do
it "filters invalid options" do
expect(filtered_options).not_to have_key(:invalid_opt)
expect(filtered_options).not_to have_key(:bad_opt)
end
it "should merge with default options" do
it "merges with default options" do
expect(filtered_options).to have_key(:ignore_whitespace_change)
end
it "should override default options" do
it "overrides default options" do
expect(filtered_options).to have_key(:max_files)
expect(filtered_options[:max_files]).to eq(100)
end
......
require 'spec_helper'
describe Gitlab::Git::GitmodulesParser do
it 'should parse a .gitmodules file correctly' do
it 'parses a .gitmodules file correctly' do
data = <<~GITMODULES
[submodule "vendor/libgit2"]
path = vendor/libgit2
......
......@@ -450,20 +450,20 @@ describe Gitlab::Git::Repository, :seed_helper do
ensure_seeds
end
it "should create a new branch" do
it "creates a new branch" do
expect(repository.create_branch('new_branch', 'master')).not_to be_nil
end
it "should create a new branch with the right name" do
it "creates a new branch with the right name" do
expect(repository.create_branch('another_branch', 'master').name).to eq('another_branch')
end
it "should fail if we create an existing branch" do
it "fails if we create an existing branch" do
repository.create_branch('duplicated_branch', 'master')
expect {repository.create_branch('duplicated_branch', 'master')}.to raise_error("Branch duplicated_branch already exists")
end
it "should fail if we create a branch from a non existing ref" do
it "fails if we create a branch from a non existing ref" do
expect {repository.create_branch('branch_based_in_wrong_ref', 'master_2_the_revenge')}.to raise_error("Invalid reference master_2_the_revenge")
end
end
......@@ -522,7 +522,7 @@ describe Gitlab::Git::Repository, :seed_helper do
describe "#refs_hash" do
subject { repository.refs_hash }
it "should have as many entries as branches and tags" do
it "has as many entries as branches and tags" do
expected_refs = SeedRepo::Repo::BRANCHES + SeedRepo::Repo::TAGS
# We flatten in case a commit is pointed at by more than one branch and/or tag
expect(subject.values.flatten.size).to eq(expected_refs.size)
......@@ -613,11 +613,11 @@ describe Gitlab::Git::Repository, :seed_helper do
end
shared_examples 'search files by content' do
it 'should have 2 items' do
it 'has 2 items' do
expect(search_results.size).to eq(2)
end
it 'should have the correct matching line' do
it 'has the correct matching line' do
expect(search_results).to contain_exactly("search-files-by-content-branch:encoding/CHANGELOG\u00001\u0000search-files-by-content change\n",
"search-files-by-content-branch:anotherfile\u00001\u0000search-files-by-content change\n")
end
......@@ -850,7 +850,7 @@ describe Gitlab::Git::Repository, :seed_helper do
context "where provides 'after' timestamp" do
options = { after: Time.iso8601('2014-03-03T20:15:01+00:00') }
it "should returns commits on or after that timestamp" do
it "returns commits on or after that timestamp" do
commits = repository.log(options)
expect(commits.size).to be > 0
......@@ -863,7 +863,7 @@ describe Gitlab::Git::Repository, :seed_helper do
context "where provides 'before' timestamp" do
options = { before: Time.iso8601('2014-03-03T20:15:01+00:00') }
it "should returns commits on or before that timestamp" do
it "returns commits on or before that timestamp" do
commits = repository.log(options)
expect(commits.size).to be > 0
......@@ -1064,14 +1064,14 @@ describe Gitlab::Git::Repository, :seed_helper do
end
describe '#find_branch' do
it 'should return a Branch for master' do
it 'returns a Branch for master' do
branch = repository.find_branch('master')
expect(branch).to be_a_kind_of(Gitlab::Git::Branch)
expect(branch.name).to eq('master')
end
it 'should handle non-existent branch' do
it 'handles non-existent branch' do
branch = repository.find_branch('this-is-garbage')
expect(branch).to eq(nil)
......
......@@ -28,7 +28,7 @@ describe Gitlab::Kubernetes::ClusterRoleBinding do
subject { cluster_role_binding.generate }
it 'should build a Kubeclient Resource' do
it 'builds a Kubeclient Resource' do
is_expected.to eq(resource)
end
end
......
......@@ -18,7 +18,7 @@ describe Gitlab::Kubernetes::ConfigMap do
let(:resource) { ::Kubeclient::Resource.new(metadata: metadata, data: application.files) }
subject { config_map.generate }
it 'should build a Kubeclient Resource' do
it 'builds a Kubeclient Resource' do
is_expected.to eq(resource)
end
end
......
......@@ -41,7 +41,7 @@ describe Gitlab::Kubernetes::Helm::BaseCommand do
describe '#pod_resource' do
subject { base_command.pod_resource }
it 'should returns a kubeclient resoure with pod content for application' do
it 'returns a kubeclient resoure with pod content for application' do
is_expected.to be_an_instance_of ::Kubeclient::Resource
end
......
......@@ -5,7 +5,7 @@ describe Gitlab::Kubernetes::Helm::Certificate do
describe '.generate_root' do
subject { described_class.generate_root }
it 'should generate a root CA that expires a long way in the future' do
it 'generates a root CA that expires a long way in the future' do
expect(subject.cert.not_after).to be > 999.years.from_now
end
end
......@@ -13,14 +13,14 @@ describe Gitlab::Kubernetes::Helm::Certificate do
describe '#issue' do
subject { described_class.generate_root.issue }
it 'should generate a cert that expires soon' do
it 'generates a cert that expires soon' do
expect(subject.cert.not_after).to be < 60.minutes.from_now
end
context 'passing in INFINITE_EXPIRY' do
subject { described_class.generate_root.issue(expires_in: described_class::INFINITE_EXPIRY) }
it 'should generate a cert that expires a long way in the future' do
it 'generates a cert that expires a long way in the future' do
expect(subject.cert.not_after).to be > 999.years.from_now
end
end
......
......@@ -10,11 +10,11 @@ describe Gitlab::Kubernetes::Helm::Pod do
subject { described_class.new(command, namespace, service_account_name: service_account_name) }
context 'with a command' do
it 'should generate a Kubeclient::Resource' do
it 'generates a Kubeclient::Resource' do
expect(subject.generate).to be_a_kind_of(Kubeclient::Resource)
end
it 'should generate the appropriate metadata' do
it 'generates the appropriate metadata' do
metadata = subject.generate.metadata
expect(metadata.name).to eq("install-#{app.name}")
expect(metadata.namespace).to eq('gitlab-managed-apps')
......@@ -22,12 +22,12 @@ describe Gitlab::Kubernetes::Helm::Pod do
expect(metadata.labels['gitlab.org/application']).to eq(app.name)
end
it 'should generate a container spec' do
it 'generates a container spec' do
spec = subject.generate.spec
expect(spec.containers.count).to eq(1)
end
it 'should generate the appropriate specifications for the container' do
it 'generates the appropriate specifications for the container' do
container = subject.generate.spec.containers.first
expect(container.name).to eq('helm')
expect(container.image).to eq('registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/2.12.3-kube-1.11.7')
......@@ -37,30 +37,30 @@ describe Gitlab::Kubernetes::Helm::Pod do
expect(container.args).to match_array(["-c", "$(COMMAND_SCRIPT)"])
end
it 'should include a never restart policy' do
it 'includes a never restart policy' do
spec = subject.generate.spec
expect(spec.restartPolicy).to eq('Never')
end
it 'should include volumes for the container' do
it 'includes volumes for the container' do
container = subject.generate.spec.containers.first
expect(container.volumeMounts.first['name']).to eq('configuration-volume')
expect(container.volumeMounts.first['mountPath']).to eq("/data/helm/#{app.name}/config")
end
it 'should include a volume inside the specification' do
it 'includes a volume inside the specification' do
spec = subject.generate.spec
expect(spec.volumes.first['name']).to eq('configuration-volume')
end
it 'should mount configMap specification in the volume' do
it 'mounts configMap specification in the volume' do
volume = subject.generate.spec.volumes.first
expect(volume.configMap['name']).to eq("values-content-configuration-#{app.name}")
expect(volume.configMap['items'].first['key']).to eq(:'values.yaml')
expect(volume.configMap['items'].first['path']).to eq(:'values.yaml')
end
it 'should have no serviceAccountName' do
it 'has no serviceAccountName' do
spec = subject.generate.spec
expect(spec.serviceAccountName).to be_nil
end
......@@ -68,7 +68,7 @@ describe Gitlab::Kubernetes::Helm::Pod do
context 'with a service_account_name' do
let(:service_account_name) { 'sa' }
it 'should use the serviceAccountName provided' do
it 'uses the serviceAccountName provided' do
spec = subject.generate.spec
expect(spec.serviceAccountName).to eq(service_account_name)
end
......
......@@ -42,7 +42,7 @@ describe Gitlab::Kubernetes::RoleBinding, '#generate' do
).generate
end
it 'should build a Kubeclient Resource' do
it 'builds a Kubeclient Resource' do
is_expected.to eq(resource)
end
end
......@@ -17,7 +17,7 @@ describe Gitlab::Kubernetes::ServiceAccount do
subject { service_account.generate }
it 'should build a Kubeclient Resource' do
it 'builds a Kubeclient Resource' do
is_expected.to eq(resource)
end
end
......
......@@ -28,7 +28,7 @@ describe Gitlab::Kubernetes::ServiceAccountToken do
subject { service_account_token.generate }
it 'should build a Kubeclient Resource' do
it 'builds a Kubeclient Resource' do
is_expected.to eq(resource)
end
end
......
......@@ -97,7 +97,7 @@ describe Gitlab::SearchResults do
results.objects('merge_requests')
end
it 'it skips project filter if default project context is used' do
it 'skips project filter if default project context is used' do
allow(results).to receive(:default_project_filter).and_return(true)
expect(results).not_to receive(:project_ids_relation)
......@@ -113,7 +113,7 @@ describe Gitlab::SearchResults do
results.objects('issues')
end
it 'it skips project filter if default project context is used' do
it 'skips project filter if default project context is used' do
allow(results).to receive(:default_project_filter).and_return(true)
expect(results).not_to receive(:project_ids_relation)
......
......@@ -7,19 +7,19 @@ describe Gitlab::Tracing::Rails::ActionViewSubscriber do
using RSpec::Parameterized::TableSyntax
shared_examples 'an actionview notification' do
it 'should notify the tracer when the hash contains null values' do
it 'notifies the tracer when the hash contains null values' do
expect(subject).to receive(:postnotify_span).with(notification_name, start, finish, tags: expected_tags, exception: exception)
subject.public_send(notify_method, start, finish, payload)
end
it 'should notify the tracer when the payload is missing values' do
it 'notifies the tracer when the payload is missing values' do
expect(subject).to receive(:postnotify_span).with(notification_name, start, finish, tags: expected_tags, exception: exception)
subject.public_send(notify_method, start, finish, payload.compact)
end
it 'should not throw exceptions when with the default tracer' do
it 'does not throw exceptions when with the default tracer' do
expect { subject.public_send(notify_method, start, finish, payload) }.not_to raise_error
end
end
......
......@@ -53,19 +53,19 @@ describe Gitlab::Tracing::Rails::ActiveRecordSubscriber do
}
end
it 'should notify the tracer when the hash contains null values' do
it 'notifies the tracer when the hash contains null values' do
expect(subject).to receive(:postnotify_span).with(operation_name, start, finish, tags: expected_tags, exception: exception)
subject.notify(start, finish, payload)
end
it 'should notify the tracer when the payload is missing values' do
it 'notifies the tracer when the payload is missing values' do
expect(subject).to receive(:postnotify_span).with(operation_name, start, finish, tags: expected_tags, exception: exception)
subject.notify(start, finish, payload.compact)
end
it 'should not throw exceptions when with the default tracer' do
it 'does not throw exceptions when with the default tracer' do
expect { subject.notify(start, finish, payload) }.not_to raise_error
end
end
......
......@@ -14,7 +14,7 @@ describe Gitlab::Tracing do
end
with_them do
it 'should return the correct state for .enabled?' do
it 'returns the correct state for .enabled?' do
expect(described_class).to receive(:connection_string).and_return(connection_string)
expect(described_class.enabled?).to eq(enabled_state)
......@@ -33,7 +33,7 @@ describe Gitlab::Tracing do
end
with_them do
it 'should return the correct state for .tracing_url_enabled?' do
it 'returns the correct state for .tracing_url_enabled?' do
expect(described_class).to receive(:enabled?).and_return(enabled?)
allow(described_class).to receive(:tracing_url_template).and_return(tracing_url_template)
......@@ -56,7 +56,7 @@ describe Gitlab::Tracing do
end
with_them do
it 'should return the correct state for .tracing_url' do
it 'returns the correct state for .tracing_url' do
expect(described_class).to receive(:tracing_url_enabled?).and_return(tracing_url_enabled?)
allow(described_class).to receive(:tracing_url_template).and_return(tracing_url_template)
allow(Gitlab::CorrelationId).to receive(:current_id).and_return(correlation_id)
......
......@@ -161,7 +161,7 @@ describe Gitlab::UrlSanitizer do
end
context 'when credentials contains special chars' do
it 'should parse the URL without errors' do
it 'parses the URL without errors' do
url_sanitizer = described_class.new("https://foo:b?r@github.com/me/project.git")
expect(url_sanitizer.sanitized_url).to eq("https://github.com/me/project.git")
......
......@@ -25,7 +25,7 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
context 'with ProjectAutoDevOps with no domain' do
let(:domain) { nil }
it 'should not update cluster project' do
it 'does not update cluster project' do
migrate!
expect(clusters_without_domain.count).to eq(clusters_table.count)
......@@ -35,7 +35,7 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
context 'with ProjectAutoDevOps with domain' do
let(:domain) { 'example-domain.com' }
it 'should update all cluster projects' do
it 'updates all cluster projects' do
migrate!
expect(clusters_with_domain.count).to eq(clusters_table.count)
......@@ -49,7 +49,7 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
setup_cluster_projects_with_domain(quantity: 25, domain: nil)
end
it 'should only update specific cluster projects' do
it 'only updates specific cluster projects' do
migrate!
expect(clusters_with_domain.count).to eq(20)
......
......@@ -6,6 +6,7 @@ describe ApplicationSetting do
let(:setting) { described_class.create_from_defaults }
it { include(CacheableAttributes) }
it { include(ApplicationSettingImplementation) }
it { expect(described_class.current_without_cache).to eq(described_class.last) }
it { expect(setting).to be_valid }
......@@ -286,12 +287,10 @@ describe ApplicationSetting do
end
context 'restrict creating duplicates' do
before do
described_class.create_from_defaults
end
let!(:current_settings) { described_class.create_from_defaults }
it 'raises an record creation violation if already created' do
expect { described_class.create_from_defaults }.to raise_error(ActiveRecord::RecordNotUnique)
it 'returns the current settings' do
expect(described_class.create_from_defaults).to eq(current_settings)
end
end
......
......@@ -61,7 +61,7 @@ describe Badge do
end
shared_examples 'rendered_links' do
it 'should use the project information to populate the url placeholders' do
it 'uses the project information to populate the url placeholders' do
stub_project_commit_info(project)
expect(badge.public_send("rendered_#{method}", project)).to eq "http://www.example.com/#{project.full_path}/#{project.id}/master/whatever"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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