Commit 0e4bf1a3 authored by Vitali Tatarintev's avatar Vitali Tatarintev Committed by Shinya Maeda

Change set to let_it_be in ee/spec/requests

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