Commit 7d3e1f48 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'replace-set-with-let-it-be-in-ee-specs-batch-2' into 'master'

Replace set with let_it_be in EE specs (batch 2)

See merge request gitlab-org/gitlab!22990
parents 7a281c5d 0e4bf1a3
...@@ -24,9 +24,9 @@ describe API::AuditEvents do ...@@ -24,9 +24,9 @@ describe API::AuditEvents do
end end
context 'audit events feature is available' do context 'audit events feature is available' do
set(:user_audit_event) { create(:user_audit_event, created_at: Date.new(2000, 1, 10)) } let_it_be(:user_audit_event) { create(:user_audit_event, created_at: Date.new(2000, 1, 10)) }
set(:project_audit_event) { create(:project_audit_event, created_at: Date.new(2000, 1, 15)) } let_it_be(:project_audit_event) { create(:project_audit_event, created_at: Date.new(2000, 1, 15)) }
set(:group_audit_event) { create(:group_audit_event, created_at: Date.new(2000, 1, 20)) } let_it_be(:group_audit_event) { create(:group_audit_event, created_at: Date.new(2000, 1, 20)) }
before do before do
stub_licensed_features(admin_audit_log: true) stub_licensed_features(admin_audit_log: true)
...@@ -118,7 +118,7 @@ describe API::AuditEvents do ...@@ -118,7 +118,7 @@ describe API::AuditEvents do
end end
describe 'GET /audit_events/:id' do describe 'GET /audit_events/:id' do
set(:user_audit_event) { create(:user_audit_event, created_at: Date.new(2000, 1, 10)) } let_it_be(:user_audit_event) { create(:user_audit_event, created_at: Date.new(2000, 1, 10)) }
let(:url) { "/audit_events/#{user_audit_event.id}" } let(:url) { "/audit_events/#{user_audit_event.id}" }
context 'when authenticated, as a user' do context 'when authenticated, as a user' do
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
require 'spec_helper' require 'spec_helper'
describe API::Boards do describe API::Boards do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:board_parent) { create(:project, :public, creator_id: user.id, namespace: user.namespace ) } let_it_be(:board_parent) { create(:project, :public, creator_id: user.id, namespace: user.namespace ) }
set(:milestone) { create(:milestone, project: board_parent) } let_it_be(:milestone) { create(:milestone, project: board_parent) }
set(:board) { create(:board, project: board_parent, milestone: milestone, assignee: user) } let_it_be(:board) { create(:board, project: board_parent, milestone: milestone, assignee: user) }
it_behaves_like 'multiple and scoped issue boards', "/projects/:id/boards" it_behaves_like 'multiple and scoped issue boards', "/projects/:id/boards"
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe API::Dependencies do describe API::Dependencies do
set(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
describe "GET /projects/:id/dependencies" do describe "GET /projects/:id/dependencies" do
subject(:request) { get api("/projects/#{project.id}/dependencies", user), params: params } subject(:request) { get api("/projects/#{project.id}/dependencies", user), params: params }
......
...@@ -7,10 +7,10 @@ describe API::Geo do ...@@ -7,10 +7,10 @@ describe API::Geo do
include ApiHelpers include ApiHelpers
include ::EE::GeoHelpers include ::EE::GeoHelpers
set(:admin) { create(:admin) } let_it_be(:admin) { create(:admin) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:primary_node) { create(:geo_node, :primary) } let_it_be(:primary_node) { create(:geo_node, :primary) }
set(:secondary_node) { create(:geo_node) } let_it_be(:secondary_node) { create(:geo_node) }
let(:geo_token_header) do let(:geo_token_header) do
{ 'X-Gitlab-Token' => secondary_node.system_hook.token } { 'X-Gitlab-Token' => secondary_node.system_hook.token }
end end
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'getting project information' do describe 'getting project information' do
include GraphqlHelpers include GraphqlHelpers
set(:current_user) { create(:user) } let_it_be(:current_user) { create(:user) }
set(:design_todo) { create(:todo, user: current_user, target: create(:design)) } let_it_be(:design_todo) { create(:todo, user: current_user, target: create(:design)) }
set(:epic_todo) { create(:todo, user: current_user, target: create(:epic)) } let_it_be(:epic_todo) { create(:todo, user: current_user, target: create(:epic)) }
let(:fields) do let(:fields) do
<<~QUERY <<~QUERY
nodes { nodes {
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe 'Adding a Note to an Epic' do describe 'Adding a Note to an Epic' do
include GraphqlHelpers include GraphqlHelpers
set(:current_user) { create(:user) } let_it_be(:current_user) { create(:user) }
let(:epic) { create(:epic, group: group) } let(:epic) { create(:epic, group: group) }
let(:mutation) do let(:mutation) do
variables = { variables = {
......
...@@ -6,8 +6,8 @@ describe 'Getting designs related to an issue' do ...@@ -6,8 +6,8 @@ describe 'Getting designs related to an issue' do
include GraphqlHelpers include GraphqlHelpers
include DesignManagementTestHelpers include DesignManagementTestHelpers
set(:design) { create(:design, :with_file, versions_count: 1) } let_it_be(:design) { create(:design, :with_file, versions_count: 1) }
set(:current_user) { design.project.owner } let_it_be(:current_user) { design.project.owner }
let(:design_query) do let(:design_query) do
<<~NODE <<~NODE
designs { designs {
...@@ -112,7 +112,7 @@ describe 'Getting designs related to an issue' do ...@@ -112,7 +112,7 @@ describe 'Getting designs related to an issue' do
end end
context 'with versions' do context 'with versions' do
set(:version) { design.versions.take } let_it_be(:version) { design.versions.take }
let(:design_query) do let(:design_query) do
<<~NODE <<~NODE
designs { designs {
...@@ -151,9 +151,9 @@ describe 'Getting designs related to an issue' do ...@@ -151,9 +151,9 @@ describe 'Getting designs related to an issue' do
end end
describe 'viewing a design board at a particular version' do describe 'viewing a design board at a particular version' do
set(:issue) { design.issue } let_it_be(:issue) { design.issue }
set(:second_design) { create(:design, :with_file, issue: issue, versions_count: 1) } let_it_be(:second_design) { create(:design, :with_file, issue: issue, versions_count: 1) }
set(:deleted_design) { create(:design, :with_versions, issue: issue, deleted: true, versions_count: 1) } let_it_be(:deleted_design) { create(:design, :with_versions, issue: issue, deleted: true, versions_count: 1) }
let(:all_versions) { issue.design_versions.ordered.reverse } let(:all_versions) { issue.design_versions.ordered.reverse }
let(:design_query) do let(:design_query) do
<<~NODE <<~NODE
...@@ -318,7 +318,7 @@ describe 'Getting designs related to an issue' do ...@@ -318,7 +318,7 @@ describe 'Getting designs related to an issue' do
end end
describe 'a design with note annotations' do describe 'a design with note annotations' do
set(:note) { create(:diff_note_on_design, noteable: design, project: design.project) } let_it_be(:note) { create(:diff_note_on_design, noteable: design, project: design.project) }
let(:design_query) do let(:design_query) do
<<~NODE <<~NODE
......
...@@ -6,11 +6,11 @@ describe 'Getting designs related to an issue' do ...@@ -6,11 +6,11 @@ describe 'Getting designs related to an issue' do
include GraphqlHelpers include GraphqlHelpers
include DesignManagementTestHelpers include DesignManagementTestHelpers
set(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
set(:issue) { create(:issue, project: project) } let_it_be(:issue) { create(:issue, project: project) }
set(:design) { create(:design, :with_file, versions_count: 1, issue: issue) } let_it_be(:design) { create(:design, :with_file, versions_count: 1, issue: issue) }
set(:current_user) { project.owner } let_it_be(:current_user) { project.owner }
set(:note) { create(:diff_note_on_design, noteable: design, project: project) } let_it_be(:note) { create(:diff_note_on_design, noteable: design, project: project) }
before do before do
enable_design_management enable_design_management
......
...@@ -3,42 +3,42 @@ ...@@ -3,42 +3,42 @@
require 'spec_helper' require 'spec_helper'
describe API::GroupBoards do describe API::GroupBoards do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:non_member) { create(:user) } let_it_be(:non_member) { create(:user) }
set(:guest) { create(:user) } let_it_be(:guest) { create(:user) }
set(:admin) { create(:user, :admin) } let_it_be(:admin) { create(:user, :admin) }
set(:board_parent) { create(:group, :public) } let_it_be(:board_parent) { create(:group, :public) }
before do before do
board_parent.add_owner(user) board_parent.add_owner(user)
end end
set(:project) { create(:project, :public, namespace: board_parent ) } let_it_be(:project) { create(:project, :public, namespace: board_parent ) }
set(:dev_label) do let_it_be(:dev_label) do
create(:group_label, title: 'Development', color: '#FFAABB', group: board_parent) create(:group_label, title: 'Development', color: '#FFAABB', group: board_parent)
end end
set(:test_label) do let_it_be(:test_label) do
create(:group_label, title: 'Testing', color: '#FFAACC', group: board_parent) create(:group_label, title: 'Testing', color: '#FFAACC', group: board_parent)
end end
set(:ux_label) do let_it_be(:ux_label) do
create(:group_label, title: 'UX', color: '#FF0000', group: board_parent) create(:group_label, title: 'UX', color: '#FF0000', group: board_parent)
end end
set(:dev_list) do let_it_be(:dev_list) do
create(:list, label: dev_label, position: 1) create(:list, label: dev_label, position: 1)
end end
set(:test_list) do let_it_be(:test_list) do
create(:list, label: test_label, position: 2) create(:list, label: test_label, position: 2)
end end
set(:milestone) { create(:milestone, group: board_parent) } let_it_be(:milestone) { create(:milestone, group: board_parent) }
set(:board_label) { create(:group_label, group: board_parent) } let_it_be(:board_label) { create(:group_label, group: board_parent) }
set(:board) do let_it_be(:board) do
create(:board, group: board_parent, create(:board, group: board_parent,
milestone: milestone, milestone: milestone,
assignee: user, assignee: user,
......
...@@ -5,11 +5,11 @@ require 'spec_helper' ...@@ -5,11 +5,11 @@ require 'spec_helper'
describe API::Groups do describe API::Groups do
include GroupAPIHelpers include GroupAPIHelpers
set(:group) { create(:group) } let_it_be(:group, reload: true) { create(:group) }
set(:private_group) { create(:group, :private) } let_it_be(:private_group) { create(:group, :private) }
set(:project) { create(:project, group: group) } let_it_be(:project) { create(:project, group: group) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:another_user) { create(:user) } let_it_be(:another_user) { create(:user) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
before do before do
......
...@@ -4,13 +4,13 @@ require 'spec_helper' ...@@ -4,13 +4,13 @@ require 'spec_helper'
describe API::Internal::Base do describe API::Internal::Base do
include EE::GeoHelpers include EE::GeoHelpers
set(:primary_node) { create(:geo_node, :primary) } let_it_be(:primary_node, reload: true) { create(:geo_node, :primary) }
set(:secondary_node) { create(:geo_node) } let_it_be(:secondary_node, reload: true) { create(:geo_node) }
describe 'POST /internal/post_receive', :geo do describe 'POST /internal/post_receive', :geo do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:key) { create(:key, user: user) } let(:key) { create(:key, user: user) }
set(:project) { create(:project, :repository, :wiki_repo) } let_it_be(:project, reload: true) { create(:project, :repository, :wiki_repo) }
let(:secret_token) { Gitlab::Shell.secret_token } let(:secret_token) { Gitlab::Shell.secret_token }
let(:gl_repository) { "project-#{project.id}" } let(:gl_repository) { "project-#{project.id}" }
let(:reference_counter) { double('ReferenceCounter') } let(:reference_counter) { double('ReferenceCounter') }
...@@ -112,12 +112,12 @@ describe API::Internal::Base do ...@@ -112,12 +112,12 @@ describe API::Internal::Base do
end end
describe "POST /internal/allowed" do describe "POST /internal/allowed" do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:key) { create(:key, user: user) } let_it_be(:key) { create(:key, user: user) }
let(:secret_token) { Gitlab::Shell.secret_token } let(:secret_token) { Gitlab::Shell.secret_token }
context "for design repositories" do context "for design repositories" do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:gl_repository) { EE::Gitlab::GlRepository::DESIGN.identifier_for_container(project) } let(:gl_repository) { EE::Gitlab::GlRepository::DESIGN.identifier_for_container(project) }
it "does not allow access" do it "does not allow access" do
...@@ -191,7 +191,7 @@ describe API::Internal::Base do ...@@ -191,7 +191,7 @@ describe API::Internal::Base do
end end
context 'smartcard session required' do context 'smartcard session required' do
set(:project) { create(:project, :repository, :wiki_repo) } let_it_be(:project) { create(:project, :repository, :wiki_repo) }
subject do subject do
post( post(
......
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
require 'spec_helper' require 'spec_helper'
describe API::Issues, :mailer do describe API::Issues, :mailer do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) do let_it_be(:project) do
create(:project, :public, creator_id: user.id, namespace: user.namespace) create(:project, :public, creator_id: user.id, namespace: user.namespace)
end end
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:epic) { create(:epic, group: group) } let_it_be(:epic) { create(:epic, group: group) }
set(:group_project) { create(:project, :public, creator_id: user.id, namespace: group) } let_it_be(:group_project) { create(:project, :public, creator_id: user.id, namespace: group) }
let(:user2) { create(:user) } let(:user2) { create(:user) }
set(:author) { create(:author) } let_it_be(:author) { create(:author) }
set(:assignee) { create(:assignee) } let_it_be(:assignee) { create(:assignee) }
let(:issue_title) { 'foo' } let(:issue_title) { 'foo' }
let(:issue_description) { 'closed' } let(:issue_description) { 'closed' }
let!(:issue) do let!(:issue) do
...@@ -28,7 +28,7 @@ describe API::Issues, :mailer do ...@@ -28,7 +28,7 @@ describe API::Issues, :mailer do
description: issue_description description: issue_description
end end
set(:milestone) { create(:milestone, title: '1.0.0', project: project) } let_it_be(:milestone) { create(:milestone, title: '1.0.0', project: project) }
before(:all) do before(:all) do
project.add_reporter(user) project.add_reporter(user)
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
require 'spec_helper' require 'spec_helper'
describe API::Jobs do describe API::Jobs do
set(:project) do let_it_be(:project) do
create(:project, :repository, public_builds: false) create(:project, :repository, public_builds: false)
end end
set(:pipeline) do let_it_be(:pipeline) do
create(:ci_empty_pipeline, project: project, create(:ci_empty_pipeline, project: project,
sha: project.commit.id, sha: project.commit.id,
ref: project.default_branch) ref: project.default_branch)
......
...@@ -6,8 +6,8 @@ describe API::Ldap do ...@@ -6,8 +6,8 @@ describe API::Ldap do
include ApiHelpers include ApiHelpers
include LdapHelpers include LdapHelpers
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:admin) { create(:admin) } let_it_be(:admin) { create(:admin) }
let(:adapter) { ldap_adapter } let(:adapter) { ldap_adapter }
before do before do
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
require 'spec_helper' require 'spec_helper'
describe API::ManagedLicenses do describe API::ManagedLicenses do
set(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
set(:maintainer_user) { create(:user) } let_it_be(:maintainer_user) { create(:user) }
set(:dev_user) { create(:user) } let_it_be(:dev_user) { create(:user) }
set(:reporter_user) { create(:user) } let_it_be(:reporter_user) { create(:user) }
set(:software_license_policy) { create(:software_license_policy, project: project) } let_it_be(:software_license_policy) { create(:software_license_policy, project: project) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_management: true)
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe API::MergeRequestApprovalRules do describe API::MergeRequestApprovalRules do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:other_user) { create(:user) } let_it_be(:other_user) { create(:user) }
set(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace) } let_it_be(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace) }
let(:merge_request) { create(:merge_request, author: user, source_project: project, target_project: project) } let(:merge_request) { create(:merge_request, author: user, source_project: project, target_project: project) }
shared_examples_for 'a protected API endpoint for merge request approval rule action' do shared_examples_for 'a protected API endpoint for merge request approval rule action' do
......
...@@ -3,15 +3,14 @@ ...@@ -3,15 +3,14 @@
require 'spec_helper' require 'spec_helper'
describe API::MergeRequestApprovals do describe API::MergeRequestApprovals do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:user2) { create(:user) } let_it_be(:user2) { create(:user) }
set(:admin) { create(:user, :admin) } let_it_be(:admin) { create(:user, :admin) }
set(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) } let_it_be(:project, reload: true) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) }
let_it_be(:approver) { create :user }
let_it_be(:group) { create :group }
let(:merge_request) { create(:merge_request, :simple, author: user, assignees: [user], source_project: project, target_project: project, title: "Test", created_at: Time.now) } let(:merge_request) { create(:merge_request, :simple, author: user, assignees: [user], source_project: project, target_project: project, title: "Test", created_at: Time.now) }
set(:approver) { create :user }
set(:group) { create :group }
shared_examples_for 'an API endpoint for getting merge request approval state' do shared_examples_for 'an API endpoint for getting merge request approval state' do
context 'when source rule is present' do context 'when source rule is present' do
let(:source_rule) { create(:approval_project_rule, project: project, approvals_required: 1, name: 'zoo') } let(:source_rule) { create(:approval_project_rule, project: project, approvals_required: 1, name: 'zoo') }
...@@ -378,7 +377,7 @@ describe API::MergeRequestApprovals do ...@@ -378,7 +377,7 @@ describe API::MergeRequestApprovals do
end end
context 'as a valid approver' do context 'as a valid approver' do
set(:approver) { create(:user) } let_it_be(:approver) { create(:user) }
before do before do
project.add_developer(approver) project.add_developer(approver)
...@@ -481,8 +480,8 @@ describe API::MergeRequestApprovals do ...@@ -481,8 +480,8 @@ describe API::MergeRequestApprovals do
let!(:rule) { create(:approval_merge_request_rule, merge_request: merge_request, approvals_required: 2, name: 'foo') } let!(:rule) { create(:approval_merge_request_rule, merge_request: merge_request, approvals_required: 2, name: 'foo') }
context 'as a user who has approved the merge request' do context 'as a user who has approved the merge request' do
set(:approver) { create(:user) } let_it_be(:approver) { create(:user) }
set(:unapprover) { create(:user) } let_it_be(:unapprover) { create(:user) }
before do before do
project.add_developer(approver) project.add_developer(approver)
......
...@@ -243,11 +243,11 @@ describe API::Namespaces do ...@@ -243,11 +243,11 @@ describe API::Namespaces do
get api("/namespaces/#{namespace.id}/gitlab_subscription", current_user) get api("/namespaces/#{namespace.id}/gitlab_subscription", current_user)
end end
set(:silver_plan) { create(:silver_plan) } let_it_be(:silver_plan) { create(:silver_plan) }
set(:owner) { create(:user) } let_it_be(:owner) { create(:user) }
set(:developer) { create(:user) } let_it_be(:developer) { create(:user) }
set(:namespace) { create(:group) } let_it_be(:namespace) { create(:group) }
set(:gitlab_subscription) { create(:gitlab_subscription, hosted_plan: silver_plan, namespace: namespace) } let_it_be(:gitlab_subscription) { create(:gitlab_subscription, hosted_plan: silver_plan, namespace: namespace) }
before do before do
namespace.add_owner(owner) namespace.add_owner(owner)
...@@ -295,8 +295,9 @@ describe API::Namespaces do ...@@ -295,8 +295,9 @@ describe API::Namespaces do
put api("/namespaces/#{namespace_id}/gitlab_subscription", current_user), params: payload put api("/namespaces/#{namespace_id}/gitlab_subscription", current_user), params: payload
end end
set(:namespace) { create(:group, name: 'test.test-group.22') } let_it_be(:silver_plan) { create(:silver_plan) }
set(:gitlab_subscription) { create(:gitlab_subscription, namespace: namespace) } let_it_be(:namespace) { create(:group, name: 'test.test-group.22') }
let_it_be(:gitlab_subscription) { create(:gitlab_subscription, namespace: namespace) }
let(:params) do let(:params) do
{ {
...@@ -325,7 +326,7 @@ describe API::Namespaces do ...@@ -325,7 +326,7 @@ describe API::Namespaces do
end end
context 'when namespace does not have a subscription' do context 'when namespace does not have a subscription' do
set(:namespace_2) { create(:group) } let_it_be(:namespace_2) { create(:group) }
it 'returns a 404 error' do it 'returns a 404 error' do
do_put(namespace_2.id, admin, params) do_put(namespace_2.id, admin, params)
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
require 'spec_helper' require 'spec_helper'
describe API::ProjectApprovalRules do describe API::ProjectApprovalRules do
set(:group) { create(:group_with_members) } let_it_be(:group) { create(:group_with_members) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:user2) { create(:user) } let_it_be(:user2) { create(:user) }
set(:admin) { create(:user, :admin) } let_it_be(:admin) { create(:user, :admin) }
set(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) } let_it_be(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) }
set(:approver) { create(:user) } let_it_be(:approver) { create(:user) }
describe 'GET /projects/:id/approval_rules' do describe 'GET /projects/:id/approval_rules' do
let(:url) { "/projects/#{project.id}/approval_rules" } let(:url) { "/projects/#{project.id}/approval_rules" }
...@@ -43,7 +43,7 @@ describe API::ProjectApprovalRules do ...@@ -43,7 +43,7 @@ describe API::ProjectApprovalRules do
end end
context 'private group filtering' do context 'private group filtering' do
set(:private_group) { create :group, :private } let_it_be(:private_group) { create :group, :private }
before do before do
rule.groups << private_group rule.groups << private_group
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
require 'spec_helper' require 'spec_helper'
describe API::ProjectApprovalSettings do describe API::ProjectApprovalSettings do
set(:group) { create(:group_with_members) } let_it_be(:group) { create(:group_with_members) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:user2) { create(:user) } let_it_be(:user2) { create(:user) }
set(:admin) { create(:user, :admin) } let_it_be(:admin) { create(:user, :admin) }
set(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) } let_it_be(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) }
set(:approver) { create(:user) } let_it_be(:approver) { create(:user) }
describe 'GET /projects/:id/approval_settings' do describe 'GET /projects/:id/approval_settings' do
let(:url) { "/projects/#{project.id}/approval_settings" } let(:url) { "/projects/#{project.id}/approval_settings" }
...@@ -43,7 +43,7 @@ describe API::ProjectApprovalSettings do ...@@ -43,7 +43,7 @@ describe API::ProjectApprovalSettings do
end end
context 'private group filtering' do context 'private group filtering' do
set(:private_group) { create :group, :private } let_it_be(:private_group) { create :group, :private }
before do before do
rule.groups << private_group rule.groups << private_group
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
require 'spec_helper' require 'spec_helper'
describe API::ProjectApprovals do describe API::ProjectApprovals do
set(:group) { create(:group_with_members) } let_it_be(:group) { create(:group_with_members) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:user2) { create(:user) } let_it_be(:user2) { create(:user) }
set(:admin) { create(:user, :admin) } let_it_be(:admin) { create(:user, :admin) }
set(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) } let_it_be(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) }
set(:approver) { create(:user) } let_it_be(:approver) { create(:user) }
let(:url) { "/projects/#{project.id}/approvals" } let(:url) { "/projects/#{project.id}/approvals" }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe API::ResourceLabelEvents do describe API::ResourceLabelEvents do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
before do before do
parent.add_developer(user) parent.add_developer(user)
......
...@@ -6,7 +6,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -6,7 +6,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
include StubGitlabCalls include StubGitlabCalls
include RedisHelpers include RedisHelpers
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
describe '/api/v4/jobs' do describe '/api/v4/jobs' do
let(:runner) { create(:ci_runner, :project, projects: [project]) } let(:runner) { create(:ci_runner, :project, projects: [project]) }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe API::Search do describe API::Search do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
let(:project) { create(:project, :public, :repository, :wiki_repo, name: 'awesome project', group: group) } let(:project) { create(:project, :public, :repository, :wiki_repo, name: 'awesome project', group: group) }
shared_examples 'response is correct' do |schema:, size: 1| shared_examples 'response is correct' do |schema:, size: 1|
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require "spec_helper" require "spec_helper"
describe API::Services do describe API::Services do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) do let_it_be(:project) do
create(:project, creator_id: user.id, namespace: user.namespace) create(:project, creator_id: user.id, namespace: user.namespace)
end end
......
...@@ -10,7 +10,7 @@ describe API::Templates do ...@@ -10,7 +10,7 @@ describe API::Templates do
'LICENSE/custom.txt' => 'Custom licenses' 'LICENSE/custom.txt' => 'Custom licenses'
} }
set(:project) { create(:project, :custom_repo, files: files) } let_it_be(:project) { create(:project, :custom_repo, files: files) }
before do before do
stub_ee_application_setting(file_template_project: project) stub_ee_application_setting(file_template_project: project)
......
...@@ -3,12 +3,11 @@ ...@@ -3,12 +3,11 @@
require 'spec_helper' require 'spec_helper'
describe API::Todos do describe API::Todos do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: 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) }
describe 'GET /todos' do describe 'GET /todos' do
let(:author_1) { create(:user) } let(:author_1) { create(:user) }
let!(:pat) { create(:personal_access_token, user: user) } let!(:pat) { create(:personal_access_token, user: user) }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe API::Unleash do describe API::Unleash do
include FeatureFlagHelpers include FeatureFlagHelpers
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:project_id) { project.id } let(:project_id) { project.id }
let(:feature_enabled) { true } let(:feature_enabled) { true }
let(:params) { } let(:params) { }
......
...@@ -9,9 +9,9 @@ describe "Git HTTP requests (Geo)", :geo do ...@@ -9,9 +9,9 @@ describe "Git HTTP requests (Geo)", :geo do
include WorkhorseHelpers include WorkhorseHelpers
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
set(:project) { create(:project, :repository, :private) } let_it_be(:project) { create(:project, :repository, :private) }
set(:primary) { create(:geo_node, :primary) } let_it_be(:primary) { create(:geo_node, :primary) }
set(:secondary) { create(:geo_node) } let_it_be(:secondary) { create(:geo_node) }
# Ensure the token always comes from the real time of the request # Ensure the token always comes from the real time of the request
let(:auth_token) { Gitlab::Geo::BaseRequest.new(scope: project.full_path).authorization } let(:auth_token) { Gitlab::Geo::BaseRequest.new(scope: project.full_path).authorization }
...@@ -83,7 +83,7 @@ describe "Git HTTP requests (Geo)", :geo do ...@@ -83,7 +83,7 @@ describe "Git HTTP requests (Geo)", :geo do
context 'when current node is a secondary' do context 'when current node is a secondary' do
let(:current_node) { secondary } let(:current_node) { secondary }
set(:project) { create(:project, :repository, :private) } let_it_be(:project) { create(:project, :repository, :private) }
describe 'GET info_refs' do describe 'GET info_refs' do
context 'git pull' do context 'git pull' do
......
...@@ -6,8 +6,8 @@ describe Repositories::GitHttpController, type: :request do ...@@ -6,8 +6,8 @@ describe Repositories::GitHttpController, type: :request do
include GitHttpHelpers include GitHttpHelpers
describe 'GET #info_refs' do describe 'GET #info_refs' do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, :repository, :private) } let_it_be(:project) { create(:project, :repository, :private) }
let(:path) { "#{project.full_path}.git" } let(:path) { "#{project.full_path}.git" }
let(:env) { { user: user.username, password: user.password } } let(:env) { { user: user.username, password: user.password } }
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
require 'spec_helper' require 'spec_helper'
describe Clusters::EnvironmentEntity do describe Clusters::EnvironmentEntity do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:project) { create(:project, group: group) } let_it_be(:project) { create(:project, group: group) }
set(:cluster) { create(:cluster_for_group, groups: [group]) } let_it_be(:cluster) { create(:cluster_for_group, groups: [group]) }
it 'inherits from API::Entities::EnvironmentBasic' do it 'inherits from API::Entities::EnvironmentBasic' do
expect(described_class).to be < API::Entities::EnvironmentBasic expect(described_class).to be < API::Entities::EnvironmentBasic
......
...@@ -5,10 +5,9 @@ require 'spec_helper' ...@@ -5,10 +5,9 @@ require 'spec_helper'
describe Clusters::EnvironmentSerializer do describe Clusters::EnvironmentSerializer do
include KubernetesHelpers include KubernetesHelpers
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, namespace: user.namespace) } let_it_be(:project) { create(:project, namespace: user.namespace) }
set(:cluster) { create(:cluster) } let_it_be(:cluster) { create(:cluster) }
let(:resource) { create(:environment, project: project) } let(:resource) { create(:environment, project: project) }
let(:json_entity) do let(:json_entity) do
......
...@@ -6,7 +6,7 @@ describe DependencyEntity do ...@@ -6,7 +6,7 @@ describe DependencyEntity do
describe '#as_json' do describe '#as_json' do
subject { described_class.represent(dependency, request: request).as_json } subject { described_class.represent(dependency, request: request).as_json }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:project) { create(:project, :repository, :private) } let(:project) { create(:project, :repository, :private) }
let(:request) { double('request') } let(:request) { double('request') }
let(:dependency) { build(:dependency, :with_vulnerabilities, :with_licenses) } let(:dependency) { build(:dependency, :with_vulnerabilities, :with_licenses) }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe DependencyListSerializer do describe DependencyListSerializer do
set(:project) { create(:project, :repository, :private) } let_it_be(:project) { create(:project, :repository, :private) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:ci_build) { create(:ee_ci_build, :success) } let(:ci_build) { create(:ee_ci_build, :success) }
let(:dependencies) { [build(:dependency, :with_vulnerabilities, :with_licenses)] } let(:dependencies) { [build(:dependency, :with_vulnerabilities, :with_licenses)] }
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe MergeRequestPollWidgetEntity do describe MergeRequestPollWidgetEntity do
include ProjectForksHelper include ProjectForksHelper
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create :project, :repository } let_it_be(:project) { create :project, :repository }
set(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let_it_be(:merge_request, reload: true) { create(:merge_request, source_project: project, target_project: project) }
let(:request) { double('request', current_user: user) } let(:request) { double('request', current_user: user) }
before do before do
......
...@@ -5,10 +5,10 @@ require 'spec_helper' ...@@ -5,10 +5,10 @@ require 'spec_helper'
describe MergeRequestWidgetEntity do describe MergeRequestWidgetEntity do
include ProjectForksHelper include ProjectForksHelper
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create :project, :repository } let_it_be(:project, reload: true) { create :project, :repository }
set(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let_it_be(:merge_request, reload: true) { create(:merge_request, source_project: project, target_project: project) }
set(:pipeline) { create(:ci_empty_pipeline, project: project) } let_it_be(:pipeline, reload: true) { create(:ci_empty_pipeline, project: project) }
let(:request) { double('request', current_user: user) } let(:request) { double('request', current_user: user) }
before do before do
...@@ -226,7 +226,7 @@ describe MergeRequestWidgetEntity do ...@@ -226,7 +226,7 @@ describe MergeRequestWidgetEntity do
end end
describe 'blocking merge requests' do describe 'blocking merge requests' do
set(:merge_request_block) { create(:merge_request_block, blocked_merge_request: merge_request) } let_it_be(:merge_request_block) { create(:merge_request_block, blocked_merge_request: merge_request) }
let(:blocking_mr) { merge_request_block.blocking_merge_request } let(:blocking_mr) { merge_request_block.blocking_merge_request }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe PipelineSerializer do describe PipelineSerializer do
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:serializer) do let(:serializer) do
described_class.new(current_user: user) described_class.new(current_user: user)
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe Vulnerabilities::FeedbackEntity do describe Vulnerabilities::FeedbackEntity do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:request) { double('request') } let(:request) { double('request') }
let(:entity) { described_class.represent(feedback, request: request) } let(:entity) { described_class.represent(feedback, request: request) }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe Vulnerabilities::OccurrenceEntity do describe Vulnerabilities::OccurrenceEntity do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:scanner) do let(:scanner) do
create(:vulnerabilities_scanner, project: project) create(:vulnerabilities_scanner, project: project)
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
describe Vulnerabilities::OccurrenceReportsComparerEntity do describe Vulnerabilities::OccurrenceReportsComparerEntity do
describe 'container scanning report comparison' do describe 'container scanning report comparison' do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:base_occurrences) { create_list(:vulnerabilities_occurrence, 2) } let(:base_occurrences) { create_list(:vulnerabilities_occurrence, 2) }
let(:base_combined_reports) { build_list(:ci_reports_security_report, 1, created_at: nil) } let(:base_combined_reports) { build_list(:ci_reports_security_report, 1, created_at: nil) }
......
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_examples 'Insights page' do RSpec.shared_examples 'Insights page' do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
context 'as a permitted user' do context 'as a permitted user' do
before(:context) do before(:context) do
......
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_examples 'limited indexing is enabled' do RSpec.shared_examples 'limited indexing is enabled' do
set(:project) { create :project, :repository, name: 'test1' } let_it_be(:project) { create :project, :repository, name: 'test1' }
before do before do
stub_ee_application_setting(elasticsearch_limit_indexing: true) stub_ee_application_setting(elasticsearch_limit_indexing: true)
......
...@@ -8,8 +8,8 @@ RSpec.shared_examples 'report list' do ...@@ -8,8 +8,8 @@ RSpec.shared_examples 'report list' do
let(:request) { double('request') } let(:request) { double('request') }
set(:project) { create(:project, :repository, :private) } let_it_be(:project) { create(:project, :repository, :private) }
set(:developer) { create(:user) } let_it_be(:developer) { create(:user) }
subject { entity.as_json } subject { entity.as_json }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'rake_helper' require 'rake_helper'
describe 'geo:git:housekeeping' do describe 'geo:git:housekeeping' do
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
set(:registry) { ::Geo::ProjectRegistry.find_or_create_by!(project: project) } let_it_be(:registry) { ::Geo::ProjectRegistry.find_or_create_by!(project: project) }
shared_examples 'housekeeping task' do |task_name, period_name| shared_examples 'housekeeping task' do |task_name, period_name|
it "sets existing projects syncs_gc count to #{period_name}-1" do it "sets existing projects syncs_gc count to #{period_name}-1" do
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe 'admin/application_settings/_elasticsearch_form' do describe 'admin/application_settings/_elasticsearch_form' do
set(:admin) { create(:admin) } let_it_be(:admin) { create(:admin) }
let(:page) { Capybara::Node::Simple.new(rendered) } let(:page) { Capybara::Node::Simple.new(rendered) }
before do before do
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe 'admin/groups/_form' do describe 'admin/groups/_form' do
set(:admin) { create(:admin) } let_it_be(:admin) { create(:admin) }
before do before do
assign(:group, group) assign(:group, group)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe 'clusters/clusters/show' do describe 'clusters/clusters/show' do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
shared_examples 'cluster health section' do shared_examples 'cluster health section' do
let(:cluster_presenter) { cluster.present(current_user: user) } let(:cluster_presenter) { cluster.present(current_user: user) }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe 'groups/edit.html.haml' do describe 'groups/edit.html.haml' do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:group) { create(:group) } let(:group) { create(:group) }
before do before do
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe 'projects/pipelines/_tabs_content' do describe 'projects/pipelines/_tabs_content' do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:pipeline) { create(:ci_pipeline).present(current_user: user) } let(:pipeline) { create(:ci_pipeline).present(current_user: user) }
let(:locals) { { pipeline: pipeline, project: pipeline.project } } let(:locals) { { pipeline: pipeline, project: pipeline.project } }
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'shared/_clone_panel' do describe 'shared/_clone_panel' do
include EE::GeoHelpers include EE::GeoHelpers
set(:primary) { create(:geo_node, :primary) } let_it_be(:primary) { create(:geo_node, :primary) }
set(:secondary) { create(:geo_node) } let_it_be(:secondary) { create(:geo_node) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
shared_examples 'has no geo-specific instructions' do shared_examples 'has no geo-specific instructions' do
it 'has no geo-specific instructions' do it 'has no geo-specific instructions' do
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe Ci::CreateCrossProjectPipelineWorker do describe Ci::CreateCrossProjectPipelineWorker do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:pipeline) { create(:ci_pipeline, project: project) } let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
let(:bridge) { create(:ci_bridge, user: user, pipeline: pipeline) } let(:bridge) { create(:ci_bridge, user: user, pipeline: pipeline) }
let(:service) { double('pipeline creation service') } let(:service) { double('pipeline creation service') }
......
...@@ -24,7 +24,7 @@ describe DesignManagement::NewVersionWorker do ...@@ -24,7 +24,7 @@ describe DesignManagement::NewVersionWorker do
end end
context 'the version id is valid' do context 'the version id is valid' do
set(:version) { create(:design_version, :committed, designs_count: 2) } let_it_be(:version) { create(:design_version, :committed, designs_count: 2) }
it 'creates a system note' do it 'creates a system note' do
expect { worker.perform(version.id) }.to change { Note.system.count }.by(1) expect { worker.perform(version.id) }.to change { Note.system.count }.by(1)
...@@ -38,7 +38,7 @@ describe DesignManagement::NewVersionWorker do ...@@ -38,7 +38,7 @@ describe DesignManagement::NewVersionWorker do
end end
context 'the version includes multiple types of action' do context 'the version includes multiple types of action' do
set(:version) do let_it_be(:version) do
create(:design_version, :committed, create(:design_version, :committed,
created_designs: create_list(:design, 1), created_designs: create_list(:design, 1),
modified_designs: create_list(:design, 1)) modified_designs: create_list(:design, 1))
......
...@@ -14,7 +14,7 @@ describe EE::RepositoryCheck::BatchWorker do ...@@ -14,7 +14,7 @@ describe EE::RepositoryCheck::BatchWorker do
end end
context 'Geo primary' do context 'Geo primary' do
set(:primary) { create(:geo_node, :primary) } let_it_be(:primary) { create(:geo_node, :primary) }
before do before do
stub_current_geo_node(primary) stub_current_geo_node(primary)
...@@ -28,7 +28,7 @@ describe EE::RepositoryCheck::BatchWorker do ...@@ -28,7 +28,7 @@ describe EE::RepositoryCheck::BatchWorker do
end end
context 'Geo secondary' do context 'Geo secondary' do
set(:secondary) { create(:geo_node) } let_it_be(:secondary) { create(:geo_node) }
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
......
...@@ -5,12 +5,12 @@ require 'spec_helper' ...@@ -5,12 +5,12 @@ require 'spec_helper'
describe EE::RepositoryCheck::SingleRepositoryWorker do describe EE::RepositoryCheck::SingleRepositoryWorker do
include ::EE::GeoHelpers include ::EE::GeoHelpers
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
subject(:worker) { RepositoryCheck::SingleRepositoryWorker.new } subject(:worker) { RepositoryCheck::SingleRepositoryWorker.new }
context 'Geo primary' do context 'Geo primary' do
set(:primary) { create(:geo_node, :primary) } let_it_be(:primary) { create(:geo_node, :primary) }
before do before do
stub_current_geo_node(primary) stub_current_geo_node(primary)
...@@ -26,8 +26,8 @@ describe EE::RepositoryCheck::SingleRepositoryWorker do ...@@ -26,8 +26,8 @@ describe EE::RepositoryCheck::SingleRepositoryWorker do
end end
context 'Geo secondary' do context 'Geo secondary' do
set(:project_registry) { create(:geo_project_registry, project: project) } let_it_be(:project_registry) { create(:geo_project_registry, project: project) }
set(:secondary) { create(:geo_node) } let_it_be(:secondary) { create(:geo_node) }
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
......
...@@ -27,7 +27,7 @@ describe ElasticNamespaceIndexerWorker, :elastic do ...@@ -27,7 +27,7 @@ describe ElasticNamespaceIndexerWorker, :elastic do
end end
describe 'indexing and deleting' do describe 'indexing and deleting' do
set(:namespace) { create :namespace } let_it_be(:namespace) { create :namespace }
let(:projects) { create_list :project, 3, namespace: namespace } let(:projects) { create_list :project, 3, namespace: namespace }
it 'indexes all projects belonging to the namespace' do it 'indexes all projects belonging to the namespace' do
......
...@@ -6,7 +6,7 @@ RSpec.describe Geo::Batch::ProjectRegistrySchedulerWorker do ...@@ -6,7 +6,7 @@ RSpec.describe Geo::Batch::ProjectRegistrySchedulerWorker do
include ExclusiveLeaseHelpers include ExclusiveLeaseHelpers
include ::EE::GeoHelpers include ::EE::GeoHelpers
set(:secondary) { create(:geo_node) } let_it_be(:secondary) { create(:geo_node) }
let(:lease_key) { subject.lease_key } let(:lease_key) { subject.lease_key }
let(:lease_timeout) { 2.minutes } let(:lease_timeout) { 2.minutes }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Geo::Batch::ProjectRegistryWorker do RSpec.describe Geo::Batch::ProjectRegistryWorker do
include ::EE::GeoHelpers include ::EE::GeoHelpers
set(:secondary) { create(:geo_node) } let_it_be(:secondary) { create(:geo_node) }
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
......
...@@ -7,8 +7,8 @@ describe Geo::PruneEventLogWorker, :geo do ...@@ -7,8 +7,8 @@ describe Geo::PruneEventLogWorker, :geo do
subject(:worker) { described_class.new } subject(:worker) { described_class.new }
set(:primary) { create(:geo_node, :primary) } let_it_be(:primary) { create(:geo_node, :primary) }
set(:secondary) { create(:geo_node) } let_it_be(:secondary, refind: true) { create(:geo_node) }
describe '#perform' do describe '#perform' do
context 'current node secondary' do context 'current node secondary' do
...@@ -90,7 +90,7 @@ describe Geo::PruneEventLogWorker, :geo do ...@@ -90,7 +90,7 @@ describe Geo::PruneEventLogWorker, :geo do
end end
context 'multiple secondary nodes' do context 'multiple secondary nodes' do
set(:secondary2) { create(:geo_node) } let_it_be(:secondary2) { create(:geo_node) }
let!(:events) { create_list(:geo_event_log, 5, :updated_event) } let!(:events) { create_list(:geo_event_log, 5, :updated_event) }
it 'aborts when there is a node without status' do it 'aborts when there is a node without status' do
......
...@@ -6,9 +6,9 @@ describe Geo::RepositoryCleanupWorker, :geo do ...@@ -6,9 +6,9 @@ describe Geo::RepositoryCleanupWorker, :geo do
include ::EE::GeoHelpers include ::EE::GeoHelpers
describe '#perform' do describe '#perform' do
set(:primary) { create(:geo_node, :primary) } let_it_be(:primary) { create(:geo_node, :primary) }
set(:secondary) { create(:geo_node) } let_it_be(:secondary) { create(:geo_node) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
before do before do
stub_current_geo_node(secondary) stub_current_geo_node(secondary)
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe Geo::RepositoryVerification::Primary::BatchWorker, :clean_gitlab_redis_cache do describe Geo::RepositoryVerification::Primary::BatchWorker, :clean_gitlab_redis_cache do
include ::EE::GeoHelpers include ::EE::GeoHelpers
set(:healthy_not_verified) { create(:project) } let_it_be(:healthy_not_verified) { create(:project) }
let!(:primary) { create(:geo_node, :primary) } let!(:primary) { create(:geo_node, :primary) }
let(:healthy_shard) { healthy_not_verified.repository.storage } let(:healthy_shard) { healthy_not_verified.repository.storage }
......
...@@ -6,8 +6,7 @@ describe Geo::RepositoryVerification::Primary::SingleWorker, :clean_gitlab_redis ...@@ -6,8 +6,7 @@ describe Geo::RepositoryVerification::Primary::SingleWorker, :clean_gitlab_redis
include ::EE::GeoHelpers include ::EE::GeoHelpers
include ExclusiveLeaseHelpers include ExclusiveLeaseHelpers
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let!(:primary) { create(:geo_node, :primary) } let!(:primary) { create(:geo_node, :primary) }
before do before do
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe Geo::RepositoryVerification::Secondary::SchedulerWorker, :clean_gitlab_redis_cache do describe Geo::RepositoryVerification::Secondary::SchedulerWorker, :clean_gitlab_redis_cache do
include ::EE::GeoHelpers include ::EE::GeoHelpers
set(:healthy_not_verified) { create(:project) } let_it_be(:healthy_not_verified) { create(:project) }
let!(:secondary) { create(:geo_node) } let!(:secondary) { create(:geo_node) }
let(:healthy_shard) { healthy_not_verified.repository.storage } let(:healthy_shard) { healthy_not_verified.repository.storage }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe IncidentManagement::ProcessAlertWorker do describe IncidentManagement::ProcessAlertWorker do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
describe '#perform' do describe '#perform' do
let(:alert) { :alert } let(:alert) { :alert }
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
describe JiraConnect::SyncBranchWorker do describe JiraConnect::SyncBranchWorker do
describe '#perform' do describe '#perform' do
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let(:project_id) { project.id } let(:project_id) { project.id }
let(:branch_name) { 'master' } let(:branch_name) { 'master' }
let(:commit_shas) { %w(b83d6e3 5a62481) } let(:commit_shas) { %w(b83d6e3 5a62481) }
......
...@@ -7,8 +7,8 @@ describe RemoveUnreferencedLfsObjectsWorker do ...@@ -7,8 +7,8 @@ describe RemoveUnreferencedLfsObjectsWorker do
describe '#perform' do describe '#perform' do
context 'when running in a Geo primary node' do context 'when running in a Geo primary node' do
set(:primary) { create(:geo_node, :primary) } let_it_be(:primary) { create(:geo_node, :primary) }
set(:secondary) { create(:geo_node) } let_it_be(:secondary) { create(:geo_node) }
it 'logs an event to the Geo event log for every unreferenced LFS objects' do it 'logs an event to the Geo event log for every unreferenced LFS objects' do
stub_current_geo_node(primary) stub_current_geo_node(primary)
......
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