Commit 390b4230 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'fix_empty_line_after_final_let_ee' into 'master'

Automatically fixed EmptyLineAfterFinalLet in ee/

See merge request gitlab-org/gitlab!19736
parents 2b3844aa 4202a726
...@@ -90,6 +90,7 @@ describe Analytics::CycleAnalytics::StagesController do ...@@ -90,6 +90,7 @@ describe Analytics::CycleAnalytics::StagesController do
describe 'PUT `update`' do describe 'PUT `update`' do
let(:stage) { create(:cycle_analytics_group_stage, parent: group, relative_position: 15) } let(:stage) { create(:cycle_analytics_group_stage, parent: group, relative_position: 15) }
subject { put :update, params: params.merge(id: stage.id) } subject { put :update, params: params.merge(id: stage.id) }
include_examples 'group permission check on the controller level' include_examples 'group permission check on the controller level'
......
...@@ -8,6 +8,7 @@ describe Analytics::TasksByTypeController do ...@@ -8,6 +8,7 @@ describe Analytics::TasksByTypeController do
let(:label) { create(:group_label, group: group) } let(:label) { create(:group_label, group: group) }
let(:params) { { group_id: group.full_path, label_ids: [label.id], created_after: 10.days.ago, subject: 'Issue' } } let(:params) { { group_id: group.full_path, label_ids: [label.id], created_after: 10.days.ago, subject: 'Issue' } }
let!(:issue) { create(:labeled_issue, created_at: 5.days.ago, project: create(:project, group: group), labels: [label]) } let!(:issue) { create(:labeled_issue, created_at: 5.days.ago, project: create(:project, group: group), labels: [label]) }
subject { get :show, params: params } subject { get :show, params: params }
before do before do
......
...@@ -17,6 +17,7 @@ describe BoardsResponses do ...@@ -17,6 +17,7 @@ describe BoardsResponses do
describe '#serialize_as_json' do describe '#serialize_as_json' do
let!(:board) { create(:board, milestone: milestone) } let!(:board) { create(:board, milestone: milestone) }
context 'with milestone' do context 'with milestone' do
let(:milestone) { create(:milestone) } let(:milestone) { create(:milestone) }
...@@ -33,6 +34,7 @@ describe BoardsResponses do ...@@ -33,6 +34,7 @@ describe BoardsResponses do
context 'without milestone' do context 'without milestone' do
let(:milestone) { nil } let(:milestone) { nil }
it 'serialises properly' do it 'serialises properly' do
expected = { id: board.id, name: board.name }.as_json expected = { id: board.id, name: board.name }.as_json
......
...@@ -12,6 +12,7 @@ describe InternalRedirect do ...@@ -12,6 +12,7 @@ describe InternalRedirect do
end end
end end
end end
subject(:controller) { controller_class.new } subject(:controller) { controller_class.new }
describe '#host_allowed?' do describe '#host_allowed?' do
......
...@@ -73,6 +73,7 @@ describe Projects::PushRulesController do ...@@ -73,6 +73,7 @@ describe Projects::PushRulesController do
context "Updating #{rule_attr} rule" do context "Updating #{rule_attr} rule" do
context 'as an admin' do context 'as an admin' do
let(:user) { create(:admin) } let(:user) { create(:admin) }
it_behaves_like 'a setting with global default', rule_attr, updates: true it_behaves_like 'a setting with global default', rule_attr, updates: true
end end
......
...@@ -47,6 +47,7 @@ describe '[EE] Internal Group access' do ...@@ -47,6 +47,7 @@ describe '[EE] Internal Group access' do
describe 'GET /groups/:path/merge_requests' do describe 'GET /groups/:path/merge_requests' do
let(:project) { create(:project, :internal, :repository, group: group) } let(:project) { create(:project, :internal, :repository, group: group) }
subject { merge_requests_group_path(group) } subject { merge_requests_group_path(group) }
it { is_expected.to be_allowed_for(:auditor) } it { is_expected.to be_allowed_for(:auditor) }
......
...@@ -47,6 +47,7 @@ describe '[EE] Public Group access' do ...@@ -47,6 +47,7 @@ describe '[EE] Public Group access' do
describe 'GET /groups/:path/merge_requests' do describe 'GET /groups/:path/merge_requests' do
let(:project) { create(:project, :public, :repository, group: group) } let(:project) { create(:project, :public, :repository, group: group) }
subject { merge_requests_group_path(group) } subject { merge_requests_group_path(group) }
it { is_expected.to be_allowed_for(:auditor) } it { is_expected.to be_allowed_for(:auditor) }
......
...@@ -70,6 +70,7 @@ describe '[EE] Internal Project Access' do ...@@ -70,6 +70,7 @@ describe '[EE] Internal Project Access' do
describe "GET /:project_path/blob" do describe "GET /:project_path/blob" do
let(:commit) { project.repository.commit } let(:commit) { project.repository.commit }
subject { project_blob_path(project, File.join(commit.id, '.gitignore')) } subject { project_blob_path(project, File.join(commit.id, '.gitignore')) }
it { is_expected.to be_allowed_for(:auditor) } it { is_expected.to be_allowed_for(:auditor) }
...@@ -153,6 +154,7 @@ describe '[EE] Internal Project Access' do ...@@ -153,6 +154,7 @@ describe '[EE] Internal Project Access' do
describe "GET /:project_path/pipelines/:id" do describe "GET /:project_path/pipelines/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
subject { project_pipeline_path(project, pipeline) } subject { project_pipeline_path(project, pipeline) }
it { is_expected.to be_allowed_for(:auditor) } it { is_expected.to be_allowed_for(:auditor) }
...@@ -181,6 +183,7 @@ describe '[EE] Internal Project Access' do ...@@ -181,6 +183,7 @@ describe '[EE] Internal Project Access' do
describe "GET /:project_path/builds/:id" do describe "GET /:project_path/builds/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { project_job_path(project, build.id) } subject { project_job_path(project, build.id) }
context "when allowed for public and internal" do context "when allowed for public and internal" do
...@@ -208,6 +211,7 @@ describe '[EE] Internal Project Access' do ...@@ -208,6 +211,7 @@ describe '[EE] Internal Project Access' do
describe "GET /:project_path/-/environments/:id" do describe "GET /:project_path/-/environments/:id" do
let(:environment) { create(:environment, project: project) } let(:environment) { create(:environment, project: project) }
subject { project_environment_path(project, environment) } subject { project_environment_path(project, environment) }
it { is_expected.to be_allowed_for(:auditor) } it { is_expected.to be_allowed_for(:auditor) }
......
...@@ -64,6 +64,7 @@ describe '[EE] Private Project Access' do ...@@ -64,6 +64,7 @@ describe '[EE] Private Project Access' do
describe "GET /:project_path/blob" do describe "GET /:project_path/blob" do
let(:commit) { project.repository.commit } let(:commit) { project.repository.commit }
subject { project_blob_path(project, File.join(commit.id, '.gitignore')) } subject { project_blob_path(project, File.join(commit.id, '.gitignore')) }
it { is_expected.to be_allowed_for(:auditor) } it { is_expected.to be_allowed_for(:auditor) }
...@@ -135,6 +136,7 @@ describe '[EE] Private Project Access' do ...@@ -135,6 +136,7 @@ describe '[EE] Private Project Access' do
describe "GET /:project_path/-/environments/:id" do describe "GET /:project_path/-/environments/:id" do
let(:environment) { create(:environment, project: project) } let(:environment) { create(:environment, project: project) }
subject { project_environment_path(project, environment) } subject { project_environment_path(project, environment) }
it { is_expected.to be_allowed_for(:auditor) } it { is_expected.to be_allowed_for(:auditor) }
......
...@@ -70,6 +70,7 @@ describe '[EE] Public Project Access' do ...@@ -70,6 +70,7 @@ describe '[EE] Public Project Access' do
describe "GET /:project_path/pipelines/:id" do describe "GET /:project_path/pipelines/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
subject { project_pipeline_path(project, pipeline) } subject { project_pipeline_path(project, pipeline) }
it { is_expected.to be_allowed_for(:auditor) } it { is_expected.to be_allowed_for(:auditor) }
...@@ -98,6 +99,7 @@ describe '[EE] Public Project Access' do ...@@ -98,6 +99,7 @@ describe '[EE] Public Project Access' do
describe "GET /:project_path/builds/:id" do describe "GET /:project_path/builds/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { project_job_path(project, build.id) } subject { project_job_path(project, build.id) }
context "when allowed for public" do context "when allowed for public" do
...@@ -125,6 +127,7 @@ describe '[EE] Public Project Access' do ...@@ -125,6 +127,7 @@ describe '[EE] Public Project Access' do
describe "GET /:project_path/-/environments/:id" do describe "GET /:project_path/-/environments/:id" do
let(:environment) { create(:environment, project: project) } let(:environment) { create(:environment, project: project) }
subject { project_environment_path(project, environment) } subject { project_environment_path(project, environment) }
it { is_expected.to be_allowed_for(:auditor) } it { is_expected.to be_allowed_for(:auditor) }
......
...@@ -58,6 +58,7 @@ describe IssuesFinder do ...@@ -58,6 +58,7 @@ describe IssuesFinder do
describe '#with_confidentiality_access_check' do describe '#with_confidentiality_access_check' do
let(:guest) { create(:user) } let(:guest) { create(:user) }
set(:authorized_user) { create(:user) } set(:authorized_user) { create(:user) }
set(:project) { create(:project, namespace: authorized_user.namespace) } set(:project) { create(:project, namespace: authorized_user.namespace) }
set(:public_issue) { create(:issue, project: project) } set(:public_issue) { create(:issue, project: project) }
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe LicensesFinder do describe LicensesFinder do
let(:license) { create(:license) } let(:license) { create(:license) }
set(:user) { create(:admin) } set(:user) { create(:admin) }
it 'returns a license by id' do it 'returns a license by id' do
......
...@@ -13,6 +13,7 @@ describe Packages::GroupPackagesFinder do ...@@ -13,6 +13,7 @@ describe Packages::GroupPackagesFinder do
describe '#execute' do describe '#execute' do
let(:params) { { exclude_subgroups: false } } let(:params) { { exclude_subgroups: false } }
subject { described_class.new(user, group, params).execute } subject { described_class.new(user, group, params).execute }
shared_examples 'with package type' do |package_type| shared_examples 'with package type' do |package_type|
......
...@@ -5,12 +5,14 @@ require 'spec_helper' ...@@ -5,12 +5,14 @@ require 'spec_helper'
describe Mutations::MergeRequests::SetAssignees do describe Mutations::MergeRequests::SetAssignees do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) }
describe '#resolve' do describe '#resolve' do
let(:assignees) { create_list(:user, 3) } let(:assignees) { create_list(:user, 3) }
let(:assignee_usernames) { assignees.map(&:username) } let(:assignee_usernames) { assignees.map(&:username) }
let(:mutated_merge_request) { subject[:merge_request] } let(:mutated_merge_request) { subject[:merge_request] }
subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, assignee_usernames: assignee_usernames) } subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, assignee_usernames: assignee_usernames) }
before do before do
......
...@@ -52,6 +52,7 @@ describe LabelsHelper do ...@@ -52,6 +52,7 @@ describe LabelsHelper do
context 'when edit_context is a project' do context 'when edit_context is a project' do
let(:edit_context) { create(:project) } let(:edit_context) { create(:project) }
let(:label) { create(:label, project: edit_context, title: 'bug') } let(:label) { create(:label, project: edit_context, title: 'bug') }
before do before do
data.merge!({ data.merge!({
project_id: edit_context.id, project_id: edit_context.id,
......
...@@ -7,6 +7,7 @@ describe KerberosSpnegoHelper do ...@@ -7,6 +7,7 @@ describe KerberosSpnegoHelper do
describe '#spnego_credentials!' do describe '#spnego_credentials!' do
let(:gss) { double('GSSAPI::Simple') } let(:gss) { double('GSSAPI::Simple') }
let(:gss_service_name) { 'gss_service_name' } let(:gss_service_name) { 'gss_service_name' }
subject { Class.new { include KerberosSpnegoHelper }.new } subject { Class.new { include KerberosSpnegoHelper }.new }
before do before do
......
...@@ -24,6 +24,7 @@ describe LicenseHelper do ...@@ -24,6 +24,7 @@ describe LicenseHelper do
context 'normal user' do context 'normal user' do
let(:is_admin) { false } let(:is_admin) { false }
it 'displays correct error message for normal user' do it 'displays correct error message for normal user' do
expect(license_message(signed_in: true, is_admin: is_admin)).to be_blank expect(license_message(signed_in: true, is_admin: is_admin)).to be_blank
end end
......
...@@ -180,6 +180,7 @@ describe SearchHelper do ...@@ -180,6 +180,7 @@ describe SearchHelper do
let(:use_elasticsearch) { true } let(:use_elasticsearch) { true }
let(:scope) { 'commits' } let(:scope) { 'commits' }
let(:search_service) { instance_double(Search::GlobalService, use_elasticsearch?: use_elasticsearch, scope: scope) } let(:search_service) { instance_double(Search::GlobalService, use_elasticsearch?: use_elasticsearch, scope: scope) }
subject { show_switch_to_basic_search?(search_service) } subject { show_switch_to_basic_search?(search_service) }
before do before do
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe UsersHelper do describe UsersHelper do
describe '#current_user_menu_items' do describe '#current_user_menu_items' do
let(:user) { create(:user) } let(:user) { create(:user) }
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
where( where(
......
...@@ -11,6 +11,7 @@ describe EE::Gitlab::Auth::LDAP::AccessLevels do ...@@ -11,6 +11,7 @@ describe EE::Gitlab::Auth::LDAP::AccessLevels do
uid=janedoe,ou=users,dc=example,dc=com uid=janedoe,ou=users,dc=example,dc=com
) )
end end
subject { access_levels } subject { access_levels }
context 'when access_levels is empty' do context 'when access_levels is empty' do
...@@ -40,6 +41,7 @@ describe EE::Gitlab::Auth::LDAP::AccessLevels do ...@@ -40,6 +41,7 @@ describe EE::Gitlab::Auth::LDAP::AccessLevels do
uid=janedoe,ou=users,dc=example,dc=com uid=janedoe,ou=users,dc=example,dc=com
} }
end end
before do before do
access_levels.set(master_dns, to: Gitlab::Access::MAINTAINER) access_levels.set(master_dns, to: Gitlab::Access::MAINTAINER)
access_levels.set(developer_dns, to: Gitlab::Access::DEVELOPER) access_levels.set(developer_dns, to: Gitlab::Access::DEVELOPER)
......
...@@ -311,6 +311,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do ...@@ -311,6 +311,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do
context 'when user inherits higher permissions from parent' do context 'when user inherits higher permissions from parent' do
let(:parent_group) { create(:group) } let(:parent_group) { create(:group) }
let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) } let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) }
before do before do
group.update(parent: parent_group) group.update(parent: parent_group)
parent_group.add_maintainer(user) parent_group.add_maintainer(user)
...@@ -350,6 +351,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do ...@@ -350,6 +351,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do
context 'when user inherits lower permissions from parent' do context 'when user inherits lower permissions from parent' do
let(:parent_group) { create(:group) } let(:parent_group) { create(:group) }
let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) } let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) }
before do before do
group.update(parent: parent_group) group.update(parent: parent_group)
parent_group.add_reporter(user) parent_group.add_reporter(user)
...@@ -390,6 +392,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do ...@@ -390,6 +392,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do
let(:parent_group) { create(:group) } let(:parent_group) { create(:group) }
let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) } let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) }
let(:access_requester) { parent_group.request_access(user) } let(:access_requester) { parent_group.request_access(user) }
before do before do
group.update(parent: parent_group) group.update(parent: parent_group)
parent_group.add_owner(create(:user)) parent_group.add_owner(create(:user))
...@@ -415,6 +418,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do ...@@ -415,6 +418,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do
context 'when user inherits permissions from parent and user is no longer in LDAP group' do context 'when user inherits permissions from parent and user is no longer in LDAP group' do
let(:parent_group) { create(:group) } let(:parent_group) { create(:group) }
let(:ldap_group1) { ldap_group_entry(user_dn('other_user')) } let(:ldap_group1) { ldap_group_entry(user_dn('other_user')) }
before do before do
group.update(parent: parent_group) group.update(parent: parent_group)
parent_group.add_maintainer(user) parent_group.add_maintainer(user)
...@@ -434,6 +438,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do ...@@ -434,6 +438,7 @@ describe EE::Gitlab::Auth::LDAP::Sync::Group do
let(:group1) { create(:group) } let(:group1) { create(:group) }
let(:group2) { create(:group) } let(:group2) { create(:group) }
let(:group3) { create(:group) } let(:group3) { create(:group) }
before do before do
group1.add_reporter(user) group1.add_reporter(user)
......
...@@ -6,6 +6,7 @@ describe Gitlab::Cleanup::OrphanJobArtifactFiles do ...@@ -6,6 +6,7 @@ describe Gitlab::Cleanup::OrphanJobArtifactFiles do
include ::EE::GeoHelpers include ::EE::GeoHelpers
let(:null_logger) { Logger.new('/dev/null') } let(:null_logger) { Logger.new('/dev/null') }
subject(:cleanup) { described_class.new(logger: null_logger) } subject(:cleanup) { described_class.new(logger: null_logger) }
before do before do
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe Gitlab::Analytics::CycleAnalytics::RequestParams do describe Gitlab::Analytics::CycleAnalytics::RequestParams do
let(:params) { { created_after: '2018-01-01', created_before: '2019-01-01' } } let(:params) { { created_after: '2018-01-01', created_before: '2019-01-01' } }
subject { described_class.new(params) } subject { described_class.new(params) }
describe 'validations' do describe 'validations' do
......
...@@ -70,6 +70,7 @@ describe Gitlab::Auth::AuthFinders do ...@@ -70,6 +70,7 @@ describe Gitlab::Auth::AuthFinders do
describe '#find_user_from_bearer_token' do describe '#find_user_from_bearer_token' do
let(:job) { create(:ci_build, user: user) } let(:job) { create(:ci_build, user: user) }
subject { find_user_from_bearer_token } subject { find_user_from_bearer_token }
context 'when the token is passed as an oauth token' do context 'when the token is passed as an oauth token' do
...@@ -107,6 +108,7 @@ describe Gitlab::Auth::AuthFinders do ...@@ -107,6 +108,7 @@ describe Gitlab::Auth::AuthFinders do
describe '#find_user_from_job_token' do describe '#find_user_from_job_token' do
let(:job) { create(:ci_build, user: user) } let(:job) { create(:ci_build, user: user) }
subject { find_user_from_job_token } subject { find_user_from_job_token }
shared_examples 'job token disabled' do shared_examples 'job token disabled' do
......
...@@ -60,6 +60,7 @@ describe Gitlab::Auth::Smartcard::LDAPCertificate do ...@@ -60,6 +60,7 @@ describe Gitlab::Auth::Smartcard::LDAPCertificate do
context 'user exists but it is using a new ldap certificate' do context 'user exists but it is using a new ldap certificate' do
let(:ldap_person_email) { user.email } let(:ldap_person_email) { user.email }
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
it 'finds existing user' do it 'finds existing user' do
......
...@@ -176,6 +176,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do ...@@ -176,6 +176,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
context 'when diffing two v1 reports' do context 'when diffing two v1 reports' do
let(:base_report) { build(:license_scan_report, :version_1) } let(:base_report) { build(:license_scan_report, :version_1) }
let(:head_report) { build(:license_scan_report, :version_1) } let(:head_report) { build(:license_scan_report, :version_1) }
subject { base_report.diff_with(head_report) } subject { base_report.diff_with(head_report) }
before do before do
...@@ -196,6 +197,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do ...@@ -196,6 +197,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
context 'when diffing two v2 reports' do context 'when diffing two v2 reports' do
let(:base_report) { build(:license_scan_report, :version_2) } let(:base_report) { build(:license_scan_report, :version_2) }
let(:head_report) { build(:license_scan_report, :version_2) } let(:head_report) { build(:license_scan_report, :version_2) }
subject { base_report.diff_with(head_report) } subject { base_report.diff_with(head_report) }
before do before do
...@@ -216,6 +218,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do ...@@ -216,6 +218,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
context 'when diffing a v1 report with a v2 report' do context 'when diffing a v1 report with a v2 report' do
let(:base_report) { build(:license_scan_report, :version_1) } let(:base_report) { build(:license_scan_report, :version_1) }
let(:head_report) { build(:license_scan_report, :version_2) } let(:head_report) { build(:license_scan_report, :version_2) }
subject { base_report.diff_with(head_report) } subject { base_report.diff_with(head_report) }
before do before do
...@@ -236,6 +239,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do ...@@ -236,6 +239,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
context 'when diffing a v2 report with a v1 report' do context 'when diffing a v2 report with a v1 report' do
let(:base_report) { build(:license_scan_report, :version_2) } let(:base_report) { build(:license_scan_report, :version_2) }
let(:head_report) { build(:license_scan_report, :version_1) } let(:head_report) { build(:license_scan_report, :version_1) }
subject { base_report.diff_with(head_report) } subject { base_report.diff_with(head_report) }
before do before do
......
...@@ -21,6 +21,7 @@ describe Gitlab::Elastic::ProjectSearchResults, :elastic do ...@@ -21,6 +21,7 @@ describe Gitlab::Elastic::ProjectSearchResults, :elastic do
describe 'initialize with ref' do describe 'initialize with ref' do
let(:ref) { 'refs/heads/test' } let(:ref) { 'refs/heads/test' }
subject(:results) { described_class.new(user, query, project.id, ref) } subject(:results) { described_class.new(user, query, project.id, ref) }
it { expect(results.project).to eq(project) } it { expect(results.project).to eq(project) }
......
...@@ -639,6 +639,7 @@ describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need_inlin ...@@ -639,6 +639,7 @@ describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need_inlin
describe 'Wikis' do describe 'Wikis' do
let(:results) { described_class.new(user, 'term', limit_project_ids) } let(:results) { described_class.new(user, 'term', limit_project_ids) }
subject(:wiki_blobs) { results.objects('wiki_blobs') } subject(:wiki_blobs) { results.objects('wiki_blobs') }
before do before do
......
...@@ -6,6 +6,7 @@ describe Gitlab::Geo::EventGapTracking, :clean_gitlab_redis_cache do ...@@ -6,6 +6,7 @@ describe Gitlab::Geo::EventGapTracking, :clean_gitlab_redis_cache do
let(:previous_event_id) { 7 } let(:previous_event_id) { 7 }
let(:gap_id) { previous_event_id + 1 } let(:gap_id) { previous_event_id + 1 }
let(:event_id_with_gap) { previous_event_id + 2 } let(:event_id_with_gap) { previous_event_id + 2 }
subject(:gap_tracking) { described_class.new } subject(:gap_tracking) { described_class.new }
before do before do
......
...@@ -8,6 +8,7 @@ describe Gitlab::Geo::GitPushHttp, :geo, :use_clean_rails_memory_store_caching d ...@@ -8,6 +8,7 @@ describe Gitlab::Geo::GitPushHttp, :geo, :use_clean_rails_memory_store_caching d
let(:gl_id) { 'user-1234' } let(:gl_id) { 'user-1234' }
let(:gl_repository) { 'project-77777' } let(:gl_repository) { 'project-77777' }
let(:cache_key) { "#{described_class::CACHE_KEY_PREFIX}:#{gl_id}:#{gl_repository}" } let(:cache_key) { "#{described_class::CACHE_KEY_PREFIX}:#{gl_id}:#{gl_repository}" }
set(:secondary) { create(:geo_node) } set(:secondary) { create(:geo_node) }
subject { described_class.new(gl_id, gl_repository) } subject { described_class.new(gl_id, gl_repository) }
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe Gitlab::Geo::Replication::JobArtifactRetriever, :geo do describe Gitlab::Geo::Replication::JobArtifactRetriever, :geo do
context '#execute' do context '#execute' do
let(:retriever) { described_class.new(job_artifact.id, {}) } let(:retriever) { described_class.new(job_artifact.id, {}) }
subject { retriever.execute } subject { retriever.execute }
context 'when the job artifact exists' do context 'when the job artifact exists' do
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe Gitlab::IpAddressState do describe Gitlab::IpAddressState do
let(:address) { '1.1.1.1' } let(:address) { '1.1.1.1' }
describe '.with' do describe '.with' do
it 'saves IP address' do it 'saves IP address' do
described_class.with(address) do described_class.with(address) do
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe Gitlab::Prometheus::Queries::ClusterQuery do describe Gitlab::Prometheus::Queries::ClusterQuery do
let(:client) { double('prometheus_client', query_range: nil) } let(:client) { double('prometheus_client', query_range: nil) }
subject { described_class.new(client) } subject { described_class.new(client) }
around do |example| around do |example|
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe Gitlab::Prometheus::Queries::ValidateQuery do describe Gitlab::Prometheus::Queries::ValidateQuery do
let(:client) { double('prometheus_client') } let(:client) { double('prometheus_client') }
let(:query) { 'avg(metric)' } let(:query) { 'avg(metric)' }
subject { described_class.new(client) } subject { described_class.new(client) }
context 'valid query' do context 'valid query' do
...@@ -21,6 +22,7 @@ describe Gitlab::Prometheus::Queries::ValidateQuery do ...@@ -21,6 +22,7 @@ describe Gitlab::Prometheus::Queries::ValidateQuery do
context 'invalid query' do context 'invalid query' do
let(:message) { 'message' } let(:message) { 'message' }
before do before do
allow(client).to receive(:query).with(query).and_raise(Gitlab::PrometheusClient::QueryError.new(message)) allow(client).to receive(:query).with(query).and_raise(Gitlab::PrometheusClient::QueryError.new(message))
end end
......
...@@ -10,6 +10,7 @@ describe Pseudonymizer::Dumper do ...@@ -10,6 +10,7 @@ describe Pseudonymizer::Dumper do
config: YAML.load_file(Gitlab.config.pseudonymizer.manifest) config: YAML.load_file(Gitlab.config.pseudonymizer.manifest)
) )
end end
subject(:pseudo) { described_class.new(options) } subject(:pseudo) { described_class.new(options) }
before do before do
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe Pseudonymizer::Pager do describe Pseudonymizer::Pager do
let(:page_size) { 1 } let(:page_size) { 1 }
let!(:projects) { create_list(:project, 10) } let!(:projects) { create_list(:project, 10) }
subject { described_class.new("projects", whitelisted_columns) } subject { described_class.new("projects", whitelisted_columns) }
before do before do
......
...@@ -10,6 +10,7 @@ describe Pseudonymizer::Uploader do ...@@ -10,6 +10,7 @@ describe Pseudonymizer::Uploader do
) )
end end
let(:remote_directory) { subject.send(:remote_directory) } let(:remote_directory) { subject.send(:remote_directory) }
subject { described_class.new(options) } subject { described_class.new(options) }
def mock_file(file_name) def mock_file(file_name)
......
...@@ -122,6 +122,7 @@ describe Notify do ...@@ -122,6 +122,7 @@ describe Notify do
describe 'that are approved' do describe 'that are approved' do
let(:last_approver) { create(:user) } let(:last_approver) { create(:user) }
subject { described_class.approved_merge_request_email(recipient.id, merge_request.id, last_approver.id) } subject { described_class.approved_merge_request_email(recipient.id, merge_request.id, last_approver.id) }
before do before do
...@@ -185,6 +186,7 @@ describe Notify do ...@@ -185,6 +186,7 @@ describe Notify do
describe 'that are unapproved' do describe 'that are unapproved' do
let(:last_unapprover) { create(:user) } let(:last_unapprover) { create(:user) }
subject { described_class.unapproved_merge_request_email(recipient.id, merge_request.id, last_unapprover.id) } subject { described_class.unapproved_merge_request_email(recipient.id, merge_request.id, last_unapprover.id) }
before do before do
...@@ -239,6 +241,7 @@ describe Notify do ...@@ -239,6 +241,7 @@ describe Notify do
context 'for merge requests without assignee' do context 'for merge requests without assignee' do
describe 'that are unapproved' do describe 'that are unapproved' do
let(:last_unapprover) { create(:user) } let(:last_unapprover) { create(:user) }
subject { described_class.unapproved_merge_request_email(recipient.id, merge_request_without_assignee.id, last_unapprover.id) } subject { described_class.unapproved_merge_request_email(recipient.id, merge_request_without_assignee.id, last_unapprover.id) }
before do before do
......
...@@ -11,6 +11,7 @@ describe Approvable do ...@@ -11,6 +11,7 @@ describe Approvable do
describe '#approval_feature_available?' do describe '#approval_feature_available?' do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
subject { merge_request.approval_feature_available? } subject { merge_request.approval_feature_available? }
it 'is false when feature is disabled' do it 'is false when feature is disabled' do
......
...@@ -207,6 +207,7 @@ describe DesignManagement::Version do ...@@ -207,6 +207,7 @@ describe DesignManagement::Version do
describe '#author' do describe '#author' do
let(:author) { create(:user) } let(:author) { create(:user) }
subject(:version) { create(:design_version, :committed, author: author) } subject(:version) { create(:design_version, :committed, author: author) }
it { is_expected.to have_attributes(author: author) } it { is_expected.to have_attributes(author: author) }
......
...@@ -36,6 +36,7 @@ describe List do ...@@ -36,6 +36,7 @@ describe List do
context 'when it is a milestone type' do context 'when it is a milestone type' do
let(:milestone) { build(:milestone, title: 'awesome-release') } let(:milestone) { build(:milestone, title: 'awesome-release') }
subject { described_class.new(list_type: :milestone, milestone: milestone, board: board) } subject { described_class.new(list_type: :milestone, milestone: milestone, board: board) }
it { is_expected.to be_destroyable } it { is_expected.to be_destroyable }
......
...@@ -159,6 +159,7 @@ describe GitlabSubscription do ...@@ -159,6 +159,7 @@ describe GitlabSubscription do
describe '#expired?' do describe '#expired?' do
let(:gitlab_subscription) { create(:gitlab_subscription, end_date: end_date) } let(:gitlab_subscription) { create(:gitlab_subscription, end_date: end_date) }
subject { gitlab_subscription.expired? } subject { gitlab_subscription.expired? }
context 'when end_date is expired' do context 'when end_date is expired' do
......
...@@ -266,6 +266,7 @@ describe Issue do ...@@ -266,6 +266,7 @@ describe Issue do
describe '#promoted?' do describe '#promoted?' do
let(:issue) { create(:issue) } let(:issue) { create(:issue) }
subject { issue.promoted? } subject { issue.promoted? }
context 'issue not promoted' do context 'issue not promoted' do
...@@ -487,6 +488,7 @@ describe Issue do ...@@ -487,6 +488,7 @@ describe Issue do
describe 'current designs' do describe 'current designs' do
let(:issue) { create(:issue) } let(:issue) { create(:issue) }
subject { issue.designs.current } subject { issue.designs.current }
context 'an issue has no designs' do context 'an issue has no designs' do
......
...@@ -304,6 +304,7 @@ describe License do ...@@ -304,6 +304,7 @@ describe License do
describe '.plan_includes_feature?' do describe '.plan_includes_feature?' do
let(:feature) { :deploy_board } let(:feature) { :deploy_board }
subject { described_class.plan_includes_feature?(plan, feature) } subject { described_class.plan_includes_feature?(plan, feature) }
context 'when addon included' do context 'when addon included' do
...@@ -669,6 +670,7 @@ describe License do ...@@ -669,6 +670,7 @@ describe License do
context 'when the license is the very first trial' do context 'when the license is the very first trial' do
let(:tomorrow) { Date.tomorrow } let(:tomorrow) { Date.tomorrow }
before do before do
gl_license.restrictions = { trial: true } gl_license.restrictions = { trial: true }
gl_license.expires_at = tomorrow gl_license.expires_at = tomorrow
...@@ -689,6 +691,7 @@ describe License do ...@@ -689,6 +691,7 @@ describe License do
context 'when the license is a repeated trial' do context 'when the license is a repeated trial' do
let(:yesterday) { Date.yesterday } let(:yesterday) { Date.yesterday }
before do before do
gl_license.restrictions = { trial: true } gl_license.restrictions = { trial: true }
gl_license.expires_at = Date.tomorrow gl_license.expires_at = Date.tomorrow
......
...@@ -335,6 +335,7 @@ describe MergeRequest do ...@@ -335,6 +335,7 @@ describe MergeRequest do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:current_user) { project.users.take } let(:current_user) { project.users.take }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
subject { merge_request.calculate_reactive_cache(service_class_name, current_user&.id) } subject { merge_request.calculate_reactive_cache(service_class_name, current_user&.id) }
context 'when given a known service class name' do context 'when given a known service class name' do
...@@ -713,6 +714,7 @@ describe MergeRequest do ...@@ -713,6 +714,7 @@ describe MergeRequest do
context 'when using approvals' do context 'when using approvals' do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
allow(subject).to receive(:mergeable_state?).and_return(true) allow(subject).to receive(:mergeable_state?).and_return(true)
......
...@@ -620,6 +620,7 @@ describe Namespace do ...@@ -620,6 +620,7 @@ describe Namespace do
describe '#shared_runners_remaining_minutes_percent' do describe '#shared_runners_remaining_minutes_percent' do
let(:namespace) { build(:namespace) } let(:namespace) { build(:namespace) }
subject { namespace.shared_runners_remaining_minutes_percent } subject { namespace.shared_runners_remaining_minutes_percent }
it 'returns the minutes left as a percent of the limit' do it 'returns the minutes left as a percent of the limit' do
...@@ -666,6 +667,7 @@ describe Namespace do ...@@ -666,6 +667,7 @@ describe Namespace do
describe '#shared_runners_remaining_minutes_below_threshold?' do describe '#shared_runners_remaining_minutes_below_threshold?' do
let(:namespace) { build(:namespace, last_ci_minutes_usage_notification_level: 30) } let(:namespace) { build(:namespace, last_ci_minutes_usage_notification_level: 30) }
subject { namespace.shared_runners_remaining_minutes_below_threshold? } subject { namespace.shared_runners_remaining_minutes_below_threshold? }
it 'is true when minutes left is below the notification level' do it 'is true when minutes left is below the notification level' do
......
...@@ -23,6 +23,7 @@ ICON_STATUS_HTML ...@@ -23,6 +23,7 @@ ICON_STATUS_HTML
describe '#calculate_reactive_cache' do describe '#calculate_reactive_cache' do
let(:pass_unstable) { '0' } let(:pass_unstable) { '0' }
before do before do
@service = JenkinsDeprecatedService.new @service = JenkinsDeprecatedService.new
allow(@service).to receive_messages( allow(@service).to receive_messages(
...@@ -73,6 +74,7 @@ ICON_STATUS_HTML ...@@ -73,6 +74,7 @@ ICON_STATUS_HTML
describe 'multiproject enabled' do describe 'multiproject enabled' do
let!(:project) { create(:project) } let!(:project) { create(:project) }
before do before do
@service = JenkinsDeprecatedService.new @service = JenkinsDeprecatedService.new
allow(@service).to receive_messages( allow(@service).to receive_messages(
......
...@@ -1767,6 +1767,7 @@ describe Project do ...@@ -1767,6 +1767,7 @@ describe Project do
describe '#object_pool_missing?' do describe '#object_pool_missing?' do
let(:pool) { create(:pool_repository, :ready) } let(:pool) { create(:pool_repository, :ready) }
subject { create(:project, :repository, pool_repository: pool) } subject { create(:project, :repository, pool_repository: pool) }
it 'returns true when object pool is missing' do it 'returns true when object pool is missing' do
......
...@@ -657,6 +657,7 @@ describe User do ...@@ -657,6 +657,7 @@ describe User do
context 'namespace with input name exists' do context 'namespace with input name exists' do
let(:name) { 'Disney' } let(:name) { 'Disney' }
before do before do
create(:user, name: 'disney') create(:user, name: 'disney')
end end
...@@ -670,6 +671,7 @@ describe User do ...@@ -670,6 +671,7 @@ describe User do
context 'namespace with input name and suffix exists' do context 'namespace with input name and suffix exists' do
let(:name) { 'Disney' } let(:name) { 'Disney' }
before do before do
create(:user, name: 'disney') create(:user, name: 'disney')
create(:user, name: 'disney1') create(:user, name: 'disney1')
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe Clusters::InstancePolicy do describe Clusters::InstancePolicy do
let(:user) { create(:admin) } let(:user) { create(:admin) }
subject { described_class.new(user, Clusters::Instance.new) } subject { described_class.new(user, Clusters::Instance.new) }
context 'when cluster deployments is available' do context 'when cluster deployments is available' do
......
...@@ -138,6 +138,7 @@ describe GroupPolicy do ...@@ -138,6 +138,7 @@ describe GroupPolicy do
context 'with sso enforcement enabled' do context 'with sso enforcement enabled' do
let(:current_user) { guest } let(:current_user) { guest }
let_it_be(:saml_provider) { create(:saml_provider, group: group, enforced_sso: true) } let_it_be(:saml_provider) { create(:saml_provider, group: group, enforced_sso: true) }
context 'when the session has been set globally' do context 'when the session has been set globally' do
......
...@@ -105,6 +105,7 @@ describe 'Updating an Epic' do ...@@ -105,6 +105,7 @@ describe 'Updating an Epic' do
context 'when changing labels of the epic' do context 'when changing labels of the epic' do
let(:attributes) { { add_label_ids: [label_1.id, label_3.id], remove_label_ids: label_2.id } } let(:attributes) { { add_label_ids: [label_1.id, label_3.id], remove_label_ids: label_2.id } }
it 'adds and removes labels correctly' do it 'adds and removes labels correctly' do
post_graphql_mutation(mutation, current_user: current_user) post_graphql_mutation(mutation, current_user: current_user)
......
...@@ -27,6 +27,7 @@ describe API::Issues, :mailer do ...@@ -27,6 +27,7 @@ describe API::Issues, :mailer do
title: issue_title, title: issue_title,
description: issue_description description: issue_description
end end
set(:milestone) { create(:milestone, title: '1.0.0', project: project) } set(:milestone) { create(:milestone, title: '1.0.0', project: project) }
before(:all) do before(:all) do
......
...@@ -9,6 +9,7 @@ describe API::ProjectImport do ...@@ -9,6 +9,7 @@ describe API::ProjectImport do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:file) { File.join('spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz') } let(:file) { File.join('spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz') }
let(:namespace) { create(:group) } let(:namespace) { create(:group) }
before do before do
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path) allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
......
...@@ -6,6 +6,7 @@ describe API::Todos do ...@@ -6,6 +6,7 @@ describe API::Todos do
set(:group) { create(:group) } set(:group) { create(:group) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:epic) { create(:epic, group: group) } let(:epic) { create(:epic, group: group) }
set(:project) { create(:project, group: group) } set(:project) { create(:project, group: group) }
describe 'GET /todos' do describe 'GET /todos' do
......
...@@ -67,6 +67,7 @@ describe "Git HTTP requests (Geo)", :geo do ...@@ -67,6 +67,7 @@ describe "Git HTTP requests (Geo)", :geo do
context 'no Geo JWT token' do context 'no Geo JWT token' do
let(:env) { workhorse_internal_api_request_header } let(:env) { workhorse_internal_api_request_header }
it { is_expected.to have_gitlab_http_status(:unauthorized) } it { is_expected.to have_gitlab_http_status(:unauthorized) }
end end
......
...@@ -11,6 +11,7 @@ describe EpicNoteEntity do ...@@ -11,6 +11,7 @@ describe EpicNoteEntity do
let(:epic) { create(:epic, author: user) } let(:epic) { create(:epic, author: user) }
let(:note) { create(:note, noteable: epic, author: user) } let(:note) { create(:note, noteable: epic, author: user) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject { entity.as_json } subject { entity.as_json }
it_behaves_like 'note entity' it_behaves_like 'note entity'
......
...@@ -10,6 +10,7 @@ describe Boards::Lists::CreateService do ...@@ -10,6 +10,7 @@ describe Boards::Lists::CreateService do
context 'when assignee_id param is sent' do context 'when assignee_id param is sent' do
let(:other_user) { create(:user) } let(:other_user) { create(:user) }
subject(:service) { described_class.new(project, user, 'assignee_id' => other_user.id) } subject(:service) { described_class.new(project, user, 'assignee_id' => other_user.id) }
before do before do
...@@ -30,6 +31,7 @@ describe Boards::Lists::CreateService do ...@@ -30,6 +31,7 @@ describe Boards::Lists::CreateService do
context 'when milestone_id param is sent' do context 'when milestone_id param is sent' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:milestone) { create(:milestone, project: project) } let(:milestone) { create(:milestone, project: project) }
subject(:service) { described_class.new(project, user, 'milestone_id' => milestone.id) } subject(:service) { described_class.new(project, user, 'milestone_id' => milestone.id) }
before do before do
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe FetchSubscriptionPlansService do describe FetchSubscriptionPlansService do
describe '#execute' do describe '#execute' do
let(:endpoint_url) { 'https://customers.gitlab.com/gitlab_plans' } let(:endpoint_url) { 'https://customers.gitlab.com/gitlab_plans' }
subject { described_class.new(plan: 'bronze').execute } subject { described_class.new(plan: 'bronze').execute }
context 'when successully fetching plans data' do context 'when successully fetching plans data' do
......
...@@ -3,6 +3,7 @@ require 'spec_helper' ...@@ -3,6 +3,7 @@ require 'spec_helper'
describe Licenses::DestroyService do describe Licenses::DestroyService do
let(:license) { create(:license) } let(:license) { create(:license) }
set(:user) { create(:admin) } set(:user) { create(:admin) }
def destroy_with(user) def destroy_with(user)
......
...@@ -106,6 +106,7 @@ describe MergeRequests::ApprovalService do ...@@ -106,6 +106,7 @@ describe MergeRequests::ApprovalService do
let(:params) do let(:params) do
{ approval_password: 'incorrect' } { approval_password: 'incorrect' }
end end
it 'raises an error' do it 'raises an error' do
service_with_params = described_class.new(project, user, params) service_with_params = described_class.new(project, user, params)
expect { service_with_params.execute(merge_request) }.to raise_error(::MergeRequests::ApprovalService::IncorrectApprovalPasswordError) expect { service_with_params.execute(merge_request) }.to raise_error(::MergeRequests::ApprovalService::IncorrectApprovalPasswordError)
...@@ -116,6 +117,7 @@ describe MergeRequests::ApprovalService do ...@@ -116,6 +117,7 @@ describe MergeRequests::ApprovalService do
let(:params) do let(:params) do
{ approval_password: 'password' } { approval_password: 'password' }
end end
it 'does not raise an error' do it 'does not raise an error' do
service_with_params = described_class.new(project, user, params) service_with_params = described_class.new(project, user, params)
expect { service_with_params.execute(merge_request) }.not_to raise_error(::MergeRequests::ApprovalService::IncorrectApprovalPasswordError) expect { service_with_params.execute(merge_request) }.not_to raise_error(::MergeRequests::ApprovalService::IncorrectApprovalPasswordError)
......
...@@ -7,6 +7,7 @@ describe PersonalAccessTokens::RevokeInvalidTokens do ...@@ -7,6 +7,7 @@ describe PersonalAccessTokens::RevokeInvalidTokens do
describe '#execute' do describe '#execute' do
let(:expiration_date) { 10.days.from_now } let(:expiration_date) { 10.days.from_now }
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be(:pat) { create(:personal_access_token, expires_at: 5.days.from_now, user: user) } let_it_be(:pat) { create(:personal_access_token, expires_at: 5.days.from_now, user: user) }
let_it_be(:invalid_pat1) { create(:personal_access_token, expires_at: nil, user: user) } let_it_be(:invalid_pat1) { create(:personal_access_token, expires_at: nil, user: user) }
......
...@@ -565,6 +565,7 @@ describe QuickActions::InterpretService do ...@@ -565,6 +565,7 @@ describe QuickActions::InterpretService do
context 'when child and parent epics are in different groups' do context 'when child and parent epics are in different groups' do
let(:child_epic) { create(:epic, group: group, parent: epic) } let(:child_epic) { create(:epic, group: group, parent: epic) }
context 'when child epic is in a parent group of the parent epic' do context 'when child epic is in a parent group of the parent epic' do
before do before do
epic.update!(group: subgroup) epic.update!(group: subgroup)
......
...@@ -86,6 +86,7 @@ describe Search::GroupService, :elastic do ...@@ -86,6 +86,7 @@ describe Search::GroupService, :elastic do
{ project_level: :internal, feature_access_level: :enabled, membership: :guest, expected_count: 1 } { project_level: :internal, feature_access_level: :enabled, membership: :guest, expected_count: 1 }
] ]
end end
where(:project_level, :feature_access_level, :membership, :expected_count) do where(:project_level, :feature_access_level, :membership, :expected_count) do
permission_table_for_reporter_feature_access permission_table_for_reporter_feature_access
end end
......
...@@ -24,6 +24,7 @@ RSpec.shared_examples 'additional custom metrics query' do ...@@ -24,6 +24,7 @@ RSpec.shared_examples 'additional custom metrics query' do
context 'with custom metrics' do context 'with custom metrics' do
let!(:metric) { create(:prometheus_metric, project: project) } let!(:metric) { create(:prometheus_metric, project: project) }
before do before do
allow(client).to receive(:query_range).with('avg(metric)', any_args).and_return(query_range_result) allow(client).to receive(:query_range).with('avg(metric)', any_args).and_return(query_range_result)
end end
......
...@@ -73,6 +73,7 @@ shared_examples 'returns paginated packages' do ...@@ -73,6 +73,7 @@ shared_examples 'returns paginated packages' do
context 'when viewing the first page' do context 'when viewing the first page' do
let(:page) { 1 } let(:page) { 1 }
it 'returns first 2 packages' do it 'returns first 2 packages' do
get api(url, user), params: { page: page, per_page: per_page } get api(url, user), params: { page: page, per_page: per_page }
...@@ -82,6 +83,7 @@ shared_examples 'returns paginated packages' do ...@@ -82,6 +83,7 @@ shared_examples 'returns paginated packages' do
context 'when viewing the second page' do context 'when viewing the second page' do
let(:page) { 2 } let(:page) { 2 }
it 'returns first 2 packages' do it 'returns first 2 packages' do
get api(url, user), params: { page: page, per_page: per_page } get api(url, user), params: { page: page, per_page: per_page }
......
...@@ -7,6 +7,7 @@ shared_examples 'report list' do ...@@ -7,6 +7,7 @@ shared_examples 'report list' do
end end
let(:request) { double('request') } let(:request) { double('request') }
set(:project) { create(:project, :repository, :private) } set(:project) { create(:project, :repository, :private) }
set(:developer) { create(:user) } set(:developer) { create(:user) }
......
...@@ -6,6 +6,7 @@ describe EE::RepositoryCheck::BatchWorker do ...@@ -6,6 +6,7 @@ describe EE::RepositoryCheck::BatchWorker do
include ::EE::GeoHelpers include ::EE::GeoHelpers
let(:shard_name) { 'default' } let(:shard_name) { 'default' }
subject(:worker) { RepositoryCheck::BatchWorker.new } subject(:worker) { RepositoryCheck::BatchWorker.new }
before do before do
......
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