Commit aec47fad authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'replace-set-to-let-it-be-in-ee-spec-services-projects' into 'master'

Change set with let_it_be in ee/spec/services/projects

See merge request gitlab-org/gitlab!22523
parents da5da758 3be85a53
...@@ -7,8 +7,8 @@ describe Projects::AfterRenameService do ...@@ -7,8 +7,8 @@ describe Projects::AfterRenameService do
describe '#execute' do describe '#execute' do
context 'when running on a primary node' do context 'when running on a 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) }
let(:project) { create(:project, :repository, :legacy_storage) } let(:project) { create(:project, :repository, :legacy_storage) }
let!(:path_before_rename) { project.path } let!(:path_before_rename) { project.path }
let!(:full_path_before_rename) { project.full_path } let!(:full_path_before_rename) { project.full_path }
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
require 'spec_helper' require 'spec_helper'
describe Projects::Alerting::NotifyService do describe Projects::Alerting::NotifyService do
set(:project) { create(:project) } let_it_be(:project, reload: true) { create(:project) }
before do before do
# We use `set(:project)` so we make sure to clear caches # We use `let_it_be(:project)` so we make sure to clear caches
project.clear_memoization(:licensed_feature_available) project.clear_memoization(:licensed_feature_available)
end end
......
...@@ -212,8 +212,8 @@ describe Projects::CreateService, '#execute' do ...@@ -212,8 +212,8 @@ describe Projects::CreateService, '#execute' do
end end
context 'when running on a primary node' do context 'when running on a 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) }
before do before do
stub_current_geo_node(primary) stub_current_geo_node(primary)
......
...@@ -34,8 +34,8 @@ describe Projects::DestroyService do ...@@ -34,8 +34,8 @@ describe Projects::DestroyService do
end end
context 'when running on a primary node' do context 'when running on a 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) }
before do before do
stub_current_geo_node(primary) stub_current_geo_node(primary)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe Projects::GitlabProjectsImportService do describe Projects::GitlabProjectsImportService do
set(:namespace) { create(:namespace) } let_it_be(:namespace) { create(:namespace) }
let(:path) { 'test-path' } let(:path) { 'test-path' }
let(:custom_template) { create(:project) } let(:custom_template) { create(:project) }
let(:overwrite) { false } let(:overwrite) { false }
......
...@@ -11,8 +11,8 @@ describe Projects::HashedStorage::MigrateAttachmentsService do ...@@ -11,8 +11,8 @@ describe Projects::HashedStorage::MigrateAttachmentsService do
let(:old_attachments_path) { legacy_storage.disk_path } let(:old_attachments_path) { legacy_storage.disk_path }
let(:new_attachments_path) { hashed_storage.disk_path } let(:new_attachments_path) { hashed_storage.disk_path }
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) }
subject { described_class.new(project: project, old_disk_path: old_attachments_path) } subject { described_class.new(project: project, old_disk_path: old_attachments_path) }
......
...@@ -4,8 +4,8 @@ require 'spec_helper' ...@@ -4,8 +4,8 @@ require 'spec_helper'
describe Projects::ImportExport::ExportService do describe Projects::ImportExport::ExportService do
describe '#execute' do describe '#execute' do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:shared) { project.import_export_shared } let(:shared) { project.import_export_shared }
let(:service) { described_class.new(project, user) } let(:service) { described_class.new(project, user) }
let!(:after_export_strategy) { Gitlab::ImportExport::AfterExportStrategies::DownloadNotificationStrategy.new } let!(:after_export_strategy) { Gitlab::ImportExport::AfterExportStrategies::DownloadNotificationStrategy.new }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe Projects::Operations::UpdateService do describe Projects::Operations::UpdateService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:result) { subject.execute } let(:result) { subject.execute }
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
describe Projects::Prometheus::Alerts::CreateEventsService do describe Projects::Prometheus::Alerts::CreateEventsService do
let(:user) { create(:user) } let(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:metric) { create(:prometheus_metric, project: project) } let(:metric) { create(:prometheus_metric, project: project) }
let(:service) { described_class.new(project, user, alerts_payload) } let(:service) { described_class.new(project, user, alerts_payload) }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe Projects::Prometheus::Alerts::CreateService do describe Projects::Prometheus::Alerts::CreateService do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:service) { described_class.new(project, user, params) } let(:service) { described_class.new(project, user, params) }
...@@ -12,9 +12,9 @@ describe Projects::Prometheus::Alerts::CreateService do ...@@ -12,9 +12,9 @@ describe Projects::Prometheus::Alerts::CreateService do
describe '#execute' do describe '#execute' do
context 'with params' do context 'with params' do
set(:environment) { create(:environment, project: project) } let_it_be(:environment) { create(:environment, project: project) }
set(:metric) do let_it_be(:metric) do
create(:prometheus_metric, project: project) create(:prometheus_metric, project: project)
end end
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe Projects::Prometheus::Alerts::DestroyService do describe Projects::Prometheus::Alerts::DestroyService do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:alert) { create(:prometheus_alert, project: project) } let_it_be(:alert) { create(:prometheus_alert, project: project) }
let(:service) { described_class.new(project, user, nil) } let(:service) { described_class.new(project, user, nil) }
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
require 'spec_helper' require 'spec_helper'
describe Projects::Prometheus::Alerts::NotifyService do describe Projects::Prometheus::Alerts::NotifyService do
set(:project) { create(:project) } let_it_be(:project, reload: true) { create(:project) }
let(:service) { described_class.new(project, nil, payload) } let(:service) { described_class.new(project, nil, payload) }
let(:token_input) { 'token' } let(:token_input) { 'token' }
let(:subject) { service.execute(token_input) } let(:subject) { service.execute(token_input) }
before do before do
# We use `set(:project)` so we make sure to clear caches # We use `let_it_be(:project)` so we make sure to clear caches
project.clear_memoization(:licensed_feature_available) project.clear_memoization(:licensed_feature_available)
end end
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
require 'spec_helper' require 'spec_helper'
describe Projects::Prometheus::Alerts::UpdateService do describe Projects::Prometheus::Alerts::UpdateService do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:environment) { create(:environment, project: project) } let_it_be(:environment) { create(:environment, project: project) }
set(:alert) do let_it_be(:alert) do
create(:prometheus_alert, project: project, environment: environment) create(:prometheus_alert, project: project, environment: environment)
end end
......
...@@ -16,8 +16,8 @@ describe Projects::TransferService do ...@@ -16,8 +16,8 @@ describe Projects::TransferService do
end end
context 'when running on a primary node' do context 'when running on a 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' do it 'logs an event to the Geo event log' do
stub_current_geo_node(primary) stub_current_geo_node(primary)
......
...@@ -110,8 +110,8 @@ describe Projects::UpdateService, '#execute' do ...@@ -110,8 +110,8 @@ describe Projects::UpdateService, '#execute' do
context 'triggering wiki Geo syncs', :geo do context 'triggering wiki Geo syncs', :geo do
context 'on a Geo primary' do context 'on a Geo primary' 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) }
before do before 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