Commit e4e8f18c authored by Vitali Tatarintev's avatar Vitali Tatarintev

Change set to let_it_be in ee/spec/models

Contributes to a removal of rspec-set gem
parent cbb9492a
......@@ -6,8 +6,8 @@ describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state do
include ::EE::GeoHelpers
include ExclusiveLeaseHelpers
let_it_be(:primary) { create(:geo_node, :primary) }
let_it_be(:secondary) { create(:geo_node) }
let_it_be(:primary, reload: true) { create(:geo_node, :primary) }
let_it_be(:secondary, reload: true) { create(:geo_node) }
let(:options) { {} }
subject(:daemon) { described_class.new(options) }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Alerting::ProjectAlertingSetting do
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
subject { create(:project_alerting_setting, project: project) }
......
......@@ -267,14 +267,14 @@ describe ApplicationSetting do
where(indexing: [true, false], searching: [true, false], limiting: [true, false])
with_them do
set(:included_project_container) { create(:elasticsearch_indexed_project) }
set(:included_namespace_container) { create(:elasticsearch_indexed_namespace) }
let_it_be(:included_project_container) { create(:elasticsearch_indexed_project) }
let_it_be(:included_namespace_container) { create(:elasticsearch_indexed_namespace) }
set(:included_project) { included_project_container.project }
set(:included_namespace) { included_namespace_container.namespace }
let_it_be(:included_project) { included_project_container.project }
let_it_be(:included_namespace) { included_namespace_container.namespace }
set(:excluded_project) { create(:project) }
set(:excluded_namespace) { create(:namespace) }
let_it_be(:excluded_project) { create(:project) }
let_it_be(:excluded_namespace) { create(:namespace) }
let(:only_when_enabled_globally) { indexing && searching && !limiting }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Burndown do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
let(:start_date) { "2017-03-01" }
let(:due_date) { "2017-03-03" }
......@@ -35,7 +35,7 @@ describe Burndown do
end
context 'when issues belong to a public project' do
set(:non_member) { create(:user) }
let_it_be(:non_member) { create(:user) }
subject do
project.update(visibility_level: Gitlab::VisibilityLevel::PUBLIC)
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe Ci::Bridge do
set(:project) { create(:project) }
set(:target_project) { create(:project, name: 'project', namespace: create(:namespace, name: 'my')) }
set(:pipeline) { create(:ci_pipeline, project: project) }
let_it_be(:project) { create(:project) }
let_it_be(:target_project) { create(:project, name: 'project', namespace: create(:namespace, name: 'my')) }
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
let(:bridge) do
create(:ci_bridge, :variables, status: :created,
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Ci::Build do
set(:group) { create(:group, plan: :bronze_plan) }
let_it_be(:group) { create(:group, plan: :bronze_plan) }
let(:project) { create(:project, :repository, group: group) }
let(:pipeline) do
......
......@@ -6,8 +6,8 @@ describe Ci::JobArtifact do
include EE::GeoHelpers
describe '#destroy' 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 'creates a JobArtifactDeletedEvent' do
stub_current_geo_node(primary)
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe Ci::Pipeline do
let(:user) { create(:user) }
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let(:pipeline) do
create(:ci_empty_pipeline, status: :created, project: project)
......
......@@ -11,8 +11,8 @@ describe Issue, :elastic do
let(:admin) { create :user, :admin }
context 'when limited indexing is on' do
set(:project) { create :project, name: 'test1' }
set(:issue) { create :issue, project: project}
let_it_be(:project) { create :project, name: 'test1' }
let_it_be(:issue) { create :issue, project: project}
before do
stub_ee_application_setting(elasticsearch_limit_indexing: true)
......@@ -39,7 +39,7 @@ describe Issue, :elastic do
end
context 'when a group is enabled' do
set(:group) { create(:group) }
let_it_be(:group) { create(:group) }
before do
create :elasticsearch_indexed_namespace, namespace: group
......
......@@ -10,8 +10,8 @@ describe MergeRequest, :elastic do
let(:admin) { create(:user, :admin) }
it_behaves_like 'limited indexing is enabled' do
set(:object) { create :merge_request, source_project: project }
set(:group) { create(:group) }
let_it_be(:object) { create :merge_request, source_project: project }
let_it_be(:group) { create(:group) }
let(:group_object) do
project = create :project, name: 'test1', group: group
create :merge_request, source_project: project
......
......@@ -8,8 +8,8 @@ describe Milestone, :elastic do
end
it_behaves_like 'limited indexing is enabled' do
set(:object) { create :milestone, project: project }
set(:group) { create(:group) }
let_it_be(:object) { create :milestone, project: project }
let_it_be(:group) { create(:group) }
let(:group_object) do
project = create :project, name: 'test1', group: group
create :milestone, project: project
......
......@@ -8,8 +8,8 @@ describe Note, :elastic do
end
it_behaves_like 'limited indexing is enabled' do
set(:object) { create :note, project: project }
set(:group) { create(:group) }
let_it_be(:object) { create :note, project: project }
let_it_be(:group) { create(:group) }
let(:group_object) do
project = create :project, name: 'test1', group: group
create :note, project: project
......
......@@ -8,7 +8,7 @@ describe Project, :elastic do
end
context 'when limited indexing is on' do
set(:project) { create :project, name: 'test1' }
let_it_be(:project) { create :project, name: 'test1' }
before do
stub_ee_application_setting(elasticsearch_limit_indexing: true)
......@@ -62,7 +62,7 @@ describe Project, :elastic do
end
context 'when a group is enabled' do
set(:group) { create(:group) }
let_it_be(:group) { create(:group) }
before do
create :elasticsearch_indexed_namespace, namespace: group
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe ProjectWiki, :elastic do
set(:project) { create(:project, :wiki_repo) }
let_it_be(:project) { create(:project, :wiki_repo) }
before do
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
......
......@@ -9,9 +9,9 @@ describe DesignManagement::Action do
describe 'scopes' do
describe '.most_recent' do
set(:design_a) { create(:design) }
set(:design_b) { create(:design) }
set(:design_c) { create(:design) }
let_it_be(:design_a) { create(:design) }
let_it_be(:design_b) { create(:design) }
let_it_be(:design_c) { create(:design) }
let(:designs) { [design_a, design_b, design_c] }
......@@ -35,15 +35,15 @@ describe DesignManagement::Action do
end
describe '.up_to_version' do
set(:issue) { create(:issue) }
set(:design_a) { create(:design, issue: issue) }
set(:design_b) { create(:design, issue: issue) }
let_it_be(:issue) { create(:issue) }
let_it_be(:design_a) { create(:design, issue: issue) }
let_it_be(:design_b) { create(:design, issue: issue) }
# let bindings are not available in before(:all) contexts,
# so we need to redefine the array on each construction.
set(:oldest) { create(:design_version, designs: [design_a, design_b]) }
set(:middle) { create(:design_version, designs: [design_a, design_b]) }
set(:newest) { create(:design_version, designs: [design_a, design_b]) }
let_it_be(:oldest) { create(:design_version, designs: [design_a, design_b]) }
let_it_be(:middle) { create(:design_version, designs: [design_a, design_b]) }
let_it_be(:newest) { create(:design_version, designs: [design_a, design_b]) }
subject { described_class.where(design: issue.designs).up_to_version(version) }
......
......@@ -5,10 +5,10 @@ require 'spec_helper'
describe DesignManagement::DesignAtVersion do
include DesignManagementTestHelpers
set(:issue) { create(:issue) }
set(:issue_b) { create(:issue) }
set(:design) { create(:design, issue: issue) }
set(:version) { create(:design_version, designs: [design]) }
let_it_be(:issue, reload: true) { create(:issue) }
let_it_be(:issue_b, reload: true) { create(:issue) }
let_it_be(:design, reload: true) { create(:design, issue: issue) }
let_it_be(:version) { create(:design_version, designs: [design]) }
describe '#id' do
subject { described_class.new(design: design, version: version) }
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe DesignManagement::DesignCollection do
include DesignManagementTestHelpers
set(:issue) { create(:issue) }
let_it_be(:issue, reload: true) { create(:issue) }
subject(:collection) { described_class.new(issue) }
......
......@@ -391,7 +391,7 @@ describe DesignManagement::Design do
end
describe '#user_notes_count', :use_clean_rails_memory_store_caching do
set(:design) { create(:design, :with_file) }
let_it_be(:design) { create(:design, :with_file) }
subject { design.user_notes_count }
......
......@@ -24,8 +24,8 @@ describe Appearance do
context 'object storage with background upload' 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) }
before do
stub_current_geo_node(primary)
......
......@@ -4,11 +4,11 @@ require 'spec_helper'
describe Event do
describe '#visible_to_user?' do
set(:non_member) { create(:user) }
set(:member) { create(:user) }
set(:guest) { create(:user) }
set(:author) { create(:author) }
set(:admin) { create(:admin) }
let_it_be(:non_member) { create(:user) }
let_it_be(:member) { create(:user) }
let_it_be(:guest) { create(:user) }
let_it_be(:author) { create(:author) }
let_it_be(:admin) { create(:admin) }
let(:epic) { create(:epic, group: group, author: author) }
let(:note_on_epic) { create(:note, :on_epic, noteable: epic) }
let(:event) { described_class.new(group: group, target: target, author: author) }
......
......@@ -59,8 +59,8 @@ describe Note do
end
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) }
before do
stub_current_geo_node(primary)
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Geo::ContainerRepositoryRegistry, :geo do
set(:registry) { create(:container_repository_registry) }
let_it_be(:registry) { create(:container_repository_registry) }
describe 'relationships' do
it { is_expected.to belong_to(:container_repository) }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe IncidentManagement::ProjectIncidentManagementSetting do
set(:project) { create(:project, :repository, create_templates: :issue) }
let_it_be(:project) { create(:project, :repository, create_templates: :issue) }
describe 'Associations' do
it { is_expected.to belong_to(:project) }
......
......@@ -9,7 +9,7 @@ describe Issue do
context 'callbacks' do
describe '.after_create' do
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let(:author) { User.alert_bot }
context 'when issue title is "New: Incident"' do
......
......@@ -5,12 +5,12 @@ require 'spec_helper'
describe LabelNote do
include Gitlab::Routing.url_helpers
set(:group) { create(:group) }
set(:user) { create(:user) }
set(:label) { create(:group_label, group: group) }
set(:label2) { create(:group_label, group: group) }
let_it_be(:group) { create(:group) }
let_it_be(:user) { create(:user) }
let_it_be(:label) { create(:group_label, group: group) }
let_it_be(:label2) { create(:group_label, group: group) }
let(:resource_parent) { group }
set(:resource) { create(:epic, group: group) }
let_it_be(:resource) { create(:epic, group: group) }
let(:project) { nil }
let(:resource_key) { resource.class.name.underscore.to_s }
let(:events) { [create(:resource_label_event, label: label, resource_key => resource)] }
......
......@@ -9,8 +9,8 @@ describe LfsObject do
subject { create(:lfs_object, :with_file) }
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' do
stub_current_geo_node(primary)
......
......@@ -5,7 +5,7 @@ require "spec_helper"
describe MergeTrain do
include ProjectForksHelper
set(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project, :repository) }
it { is_expected.to belong_to(:merge_request) }
it { is_expected.to belong_to(:user) }
......
......@@ -139,7 +139,7 @@ describe Namespace do
end
context 'when group is subgroup' do
set(:root_ancestor) { create(:group) }
let_it_be(:root_ancestor) { create(:group) }
let(:namespace) { create(:namespace, parent: root_ancestor) }
it 'is invalid' do
......@@ -159,8 +159,8 @@ describe Namespace do
describe '#move_dir' do
context 'when running on a 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) }
let(:gitlab_shell) { Gitlab::Shell.new }
let(:parent_group) { create(:group) }
let(:child_group) { create(:group, name: 'child', path: 'child', parent: parent_group) }
......
......@@ -5,8 +5,8 @@ require 'spec_helper'
describe ProjectRepositoryState do
using RSpec::Parameterized::TableSyntax
set(:project) { create(:project) }
set(:repository_state) { create(:repository_state, project_id: project.id) }
let_it_be(:project) { create(:project) }
let_it_be(:repository_state) { create(:repository_state, project_id: project.id) }
subject { repository_state }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe AlertsService do
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let(:service_params) { { project: project, active: active } }
let(:active) { true }
let(:service) { described_class.new(service_params) }
......
......@@ -423,7 +423,7 @@ describe Project do
end
describe '#environments_for_scope' do
set(:project) { create(:project) }
let_it_be(:project, reload: true) { create(:project) }
before do
create_list(:environment, 2, project: project)
......@@ -784,8 +784,8 @@ describe Project do
end
describe '#shared_runners_limit_namespace' do
set(:root_ancestor) { create(:group) }
set(:group) { create(:group, parent: root_ancestor) }
let_it_be(:root_ancestor) { create(:group) }
let_it_be(:group) { create(:group, parent: root_ancestor) }
let(:project) { create(:project, namespace: group) }
subject { project.shared_runners_limit_namespace }
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe ProjectTracingSetting do
describe '#external_url' do
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let(:tracing_setting) { project.build_tracing_setting }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe PrometheusAlert do
set(:project) { build(:project) }
let_it_be(:project) { build(:project) }
let(:metric) { build(:prometheus_metric) }
describe '.distinct_projects' do
......
......@@ -9,8 +9,8 @@ describe Repository do
TestBlob = Struct.new(:path)
set(:primary_node) { create(:geo_node, :primary) }
set(:secondary_node) { create(:geo_node) }
let_it_be(:primary_node) { create(:geo_node, :primary) }
let_it_be(:secondary_node) { create(:geo_node) }
let(:project) { create(:project, :repository) }
let(:repository) { project.repository }
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe ScopedLabelSet do
set(:kv_label1) { create(:label, title: 'key::label1') }
set(:kv_label2) { create(:label, title: 'key::label2') }
set(:kv_label3) { create(:label, title: 'key::label3') }
let_it_be(:kv_label1) { create(:label, title: 'key::label1') }
let_it_be(:kv_label2) { create(:label, title: 'key::label2') }
let_it_be(:kv_label3) { create(:label, title: 'key::label3') }
describe '.from_label_ids' do
def get_labels(sets, key)
......
......@@ -9,8 +9,8 @@ describe Upload do
subject { create(:upload, checksum: '8710d2c16809c79fee211a9693b64038a8aae99561bc86ce98a9b46b45677fe4') }
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' do
stub_current_geo_node(primary)
......
......@@ -281,8 +281,8 @@ describe Vulnerabilities::Occurrence do
end
describe '.undismissed' do
set(:project) { create(:project) }
set(:project2) { create(:project) }
let_it_be(:project) { create(:project) }
let_it_be(:project2) { create(:project) }
let!(:finding1) { create(:vulnerabilities_occurrence, project: project) }
let!(:finding2) { create(:vulnerabilities_occurrence, project: project, report_type: :dast) }
let!(:finding3) { create(:vulnerabilities_occurrence, project: project2) }
......@@ -419,7 +419,7 @@ describe Vulnerabilities::Occurrence do
end
describe 'feedback' do
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let(:occurrence) do
create(
:vulnerabilities_occurrence,
......
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