Commit 6ac86fea authored by Vitali Tatarintev's avatar Vitali Tatarintev

Change set to let_it_be in ee/spec/lib

Contributes to a removal of rspec-set gem
parent c2811c1c
......@@ -15,8 +15,8 @@ describe ContainerRegistry::EventHandler do
{ 'tag' => 'latest', 'repository' => container_repository.path }
end
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) }
before do
stub_current_geo_node(primary_node)
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe EE::API::Entities::DesignManagement::Design do
set(:design) { create(:design) }
let_it_be(:design) { create(:design) }
let(:entity) { described_class.new(design, request: double) }
subject { entity.as_json }
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
describe API::Helpers::IssuesHelpers do
set(:group) { create(:group) }
set(:project) { create(:project, group: group) }
set(:user) { create(:user) }
set(:epic) { create(:epic, group: group) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
let_it_be(:user) { create(:user) }
let_it_be(:epic) { create(:epic, group: group) }
subject(:issues_helpers) { Class.new.include(described_class).new }
......
......@@ -4,10 +4,10 @@ require 'spec_helper'
describe EventFilter do
describe '#apply_filter' do
set(:group) { create(:group, :public) }
set(:project) { create(:project, :public) }
set(:epic_event) { create(:event, :created, group: group, target: create(:epic, group: group)) }
set(:issue_event) { create(:event, :created, project: project, target: create(:issue, project: project)) }
let_it_be(:group) { create(:group, :public) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:epic_event) { create(:event, :created, group: group, target: create(:epic, group: group)) }
let_it_be(:issue_event) { create(:event, :created, project: project, target: create(:issue, project: project)) }
let(:filtered_events) { described_class.new(filter).apply_filter(Event.all) }
context 'with the "epic" filter' do
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe Gitlab::Ci::Pipeline::Chain::Validate::Abilities do
set(:project) { create(:project, :repository) }
set(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
let(:pipeline) do
build_stubbed(:ci_pipeline, project: project)
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe EE::Gitlab::Ci::Pipeline::Quota::Activity do
set(:namespace) { create(:namespace) }
set(:project) { create(:project, namespace: namespace) }
set(:gold_plan) { create(:gold_plan) }
let_it_be(:namespace) { create(:namespace) }
let_it_be(:project, reload: true) { create(:project, namespace: namespace) }
let_it_be(:gold_plan, reload: true) { create(:gold_plan) }
let(:plan_limits) { create(:plan_limits, plan: gold_plan) }
let!(:subscription) { create(:gitlab_subscription, namespace: namespace, hosted_plan: gold_plan) }
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
describe EE::Gitlab::Ci::Pipeline::Quota::JobActivity do
let_it_be(:namespace, refind: true) { create(:namespace) }
let_it_be(:project, refind: true) { create(:project, namespace: namespace) }
set(:gold_plan) { create(:gold_plan) }
set(:plan_limits) { create(:plan_limits, plan: gold_plan) }
let_it_be(:namespace) { create(:namespace) }
let_it_be(:project, reload: true) { create(:project, namespace: namespace) }
let_it_be(:gold_plan, reload: true) { create(:gold_plan) }
let_it_be(:plan_limits, reload: true) { create(:plan_limits, plan: gold_plan) }
let!(:subscription) { create(:gitlab_subscription, namespace: namespace, hosted_plan: gold_plan) }
subject { described_class.new(namespace, project) }
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
describe EE::Gitlab::Ci::Pipeline::Quota::Size do
set(:namespace) { create(:namespace) }
set(:gold_plan) { create(:gold_plan) }
set(:project) { create(:project, :repository, namespace: namespace) }
set(:plan_limits) { create(:plan_limits, plan: gold_plan) }
let_it_be(:namespace) { create(:namespace) }
let_it_be(:gold_plan, reload: true) { create(:gold_plan) }
let_it_be(:project, reload: true) { create(:project, :repository, namespace: namespace) }
let_it_be(:plan_limits) { create(:plan_limits, plan: gold_plan) }
let!(:subscription) { create(:gitlab_subscription, namespace: namespace, hosted_plan: gold_plan) }
let(:pipeline) { build_stubbed(:ci_pipeline, project: project) }
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe Gitlab::HookData::IssueBuilder do
set(:issue) { create(:issue) }
let_it_be(:issue) { create(:issue) }
let(:builder) { described_class.new(issue) }
describe '#build' do
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Gitlab::Alerting::Alert do
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let(:alert) { build(:alerting_alert, project: project, payload: payload) }
let(:payload) { {} }
......
......@@ -9,7 +9,7 @@ describe Gitlab::Checks::DiffCheck do
describe '#validate!' do
context 'no push rules active' do
set(:push_rule) { create(:push_rule) }
let_it_be(:push_rule) { create(:push_rule) }
it "does not attempt to check commits" do
expect(subject).not_to receive(:process_commits)
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe ::Gitlab::Ci::Pipeline::Chain::Limit::Activity do
set(:namespace) { create(:namespace) }
set(:project) { create(:project, namespace: namespace) }
set(:user) { create(:user) }
let_it_be(:namespace) { create(:namespace) }
let_it_be(:project) { create(:project, namespace: namespace) }
let_it_be(:user) { create(:user) }
let(:command) do
double('command', project: project, current_user: user)
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe ::Gitlab::Ci::Pipeline::Chain::Limit::JobActivity do
set(:namespace) { create(:namespace) }
set(:project) { create(:project, namespace: namespace) }
set(:user) { create(:user) }
let_it_be(:namespace) { create(:namespace) }
let_it_be(:project) { create(:project, namespace: namespace) }
let_it_be(:user) { create(:user) }
let(:command) do
double('command', project: project, current_user: user)
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe ::Gitlab::Ci::Pipeline::Chain::Limit::Size do
set(:namespace) { create(:namespace) }
set(:project) { create(:project, :repository, namespace: namespace) }
set(:user) { create(:user) }
let_it_be(:namespace) { create(:namespace) }
let_it_be(:project, reload: true) { create(:project, :repository, namespace: namespace) }
let_it_be(:user) { create(:user) }
let(:pipeline) { build(:ci_pipeline, project: project) }
......
......@@ -4,8 +4,8 @@ require 'spec_helper'
describe Gitlab::CodeOwners::Loader do
include FakeBlobHelpers
set(:group) { create(:group) }
set(:project) { create(:project, namespace: group) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, namespace: group) }
subject(:loader) { described_class.new(project, 'with-codeowners', paths) }
let(:codeowner_content) do
......
......@@ -5,10 +5,10 @@ require 'spec_helper'
describe Gitlab::CustomFileTemplates do
using RSpec::Parameterized::TableSyntax
set(:instance_template_project) { create(:project, :custom_repo, files: template_files('instance')) }
set(:group) { create(:group) }
set(:project) { create(:project, namespace: group) }
set(:group_template_project) { create(:project, :custom_repo, namespace: group, files: template_files('group')) }
let_it_be(:instance_template_project) { create(:project, :custom_repo, files: template_files('instance')) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, namespace: group) }
let_it_be(:group_template_project) { create(:project, :custom_repo, namespace: group, files: template_files('group')) }
subject(:templates) { described_class.new(template_finder, target_project) }
......@@ -86,9 +86,9 @@ describe Gitlab::CustomFileTemplates do
end
context 'in a subgroup' do
set(:subgroup) { create(:group, parent: group) }
set(:subproject) { create(:project, namespace: subgroup) }
set(:subgroup_template_project) { create(:project, :custom_repo, namespace: subgroup, files: template_files('subgroup')) }
let_it_be(:subgroup) { create(:group, parent: group) }
let_it_be(:subproject) { create(:project, namespace: subgroup) }
let_it_be(:subgroup_template_project) { create(:project, :custom_repo, namespace: subgroup, files: template_files('subgroup')) }
let(:target_project) { subproject }
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe Gitlab::Elastic::GroupSearchResults do
set(:user) { create(:user) }
set(:group) { create(:group) }
set(:guest) { create(:user).tap { |u| group.add_user(u, Gitlab::Access::GUEST) } }
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:guest) { create(:user).tap { |u| group.add_user(u, Gitlab::Access::GUEST) } }
before do
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
......
......@@ -12,8 +12,8 @@ describe Gitlab::Geo::CronManager, :geo do
subject(:manager) { described_class.new }
describe '#execute' 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) }
def init_cron_job(job_name, class_name)
job = Sidekiq::Cron::Job.new(
......
......@@ -9,7 +9,8 @@ describe Gitlab::Geo::GitPushHttp, :geo, :use_clean_rails_memory_store_caching d
let(:gl_repository) { 'project-77777' }
let(:cache_key) { "#{described_class::CACHE_KEY_PREFIX}:#{gl_id}:#{gl_repository}" }
set(:secondary) { create(:geo_node) }
let_it_be(:secondary) { create(:geo_node) }
subject { described_class.new(gl_id, gl_repository) }
describe '#cache_referrer_node' do
......
......@@ -7,8 +7,8 @@ describe Gitlab::Geo::GitPushSSHProxy, :geo do
# TODO This spec doesn't work with a relative_url_root https://gitlab.com/gitlab-org/gitlab/issues/11173
# TODO This spec doesn't work with non-localhost
set(:primary_node) { create(:geo_node, :primary, url: 'http://localhost:3001') }
set(:secondary_node) { create(:geo_node, url: 'http://localhost:3002') }
let_it_be(:primary_node) { create(:geo_node, :primary, url: 'http://localhost:3001') }
let_it_be(:secondary_node) { create(:geo_node, url: 'http://localhost:3002') }
let(:current_node) { nil }
let(:project) { create(:project, :repository) }
......
......@@ -6,7 +6,7 @@ describe Gitlab::Geo::HealthCheck, :geo do
include ::EE::GeoHelpers
using RSpec::Parameterized::TableSyntax
set(:secondary) { create(:geo_node) }
let_it_be(:secondary) { create(:geo_node) }
describe '#perform_checks' do
before do
......
......@@ -6,9 +6,8 @@ describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state do
include ::EE::GeoHelpers
include ExclusiveLeaseHelpers
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(:options) { {} }
subject(:daemon) { described_class.new(options) }
......@@ -268,7 +267,7 @@ describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state do
end
describe '#handle_single_event' do
set(:event_log) { create(:geo_event_log, :updated_event) }
let_it_be(:event_log) { create(:geo_event_log, :updated_event) }
it 'skips execution when no event data is found' do
event_log = build(:geo_event_log)
......
......@@ -6,7 +6,7 @@ describe Gitlab::Geo::LogCursor::Events::RepositoriesChangedEvent, :clean_gitlab
include ::EE::GeoHelpers
let(:logger) { Gitlab::Geo::LogCursor::Logger.new(described_class, Logger::INFO) }
set(:secondary) { create(:geo_node) }
let_it_be(:secondary) { create(:geo_node) }
let(:repositories_changed_event) { create(:geo_repositories_changed_event, geo_node: secondary) }
let(:event_log) { create(:geo_event_log, repositories_changed_event: repositories_changed_event) }
let!(:event_log_state) { create(:geo_event_log_state, event_id: event_log.id - 1) }
......
......@@ -6,7 +6,7 @@ describe Gitlab::Geo::LogCursor::Events::RepositoryUpdatedEvent, :clean_gitlab_r
include ::EE::GeoHelpers
let(:logger) { Gitlab::Geo::LogCursor::Logger.new(described_class, Logger::INFO) }
set(:secondary) { create(:geo_node) }
let_it_be(:secondary) { create(:geo_node) }
let(:project) { create(:project) }
let(:repository_updated_event) { create(:geo_repository_updated_event, project: project) }
let(:event_log) { create(:geo_event_log, repository_updated_event: repository_updated_event) }
......
......@@ -5,8 +5,8 @@ require 'spec_helper'
describe Gitlab::Geo::Replication::BaseTransfer do
include ::EE::GeoHelpers
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) }
describe '#can_transfer?' do
subject do
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe Gitlab::Geo::Replication::FileDownloader, :geo do
include EE::GeoHelpers
set(:primary_node) { create(:geo_node, :primary) }
let_it_be(:primary_node) { create(:geo_node, :primary) }
subject { downloader.execute }
......
......@@ -5,8 +5,8 @@ require 'spec_helper'
describe Gitlab::Geo::Replication::FileTransfer do
include ::EE::GeoHelpers
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(:user) { create(:user, :with_avatar) }
let(:upload) { Upload.find_by(model: user, uploader: 'AvatarUploader') }
......
......@@ -5,9 +5,9 @@ require 'spec_helper'
describe Gitlab::Geo::Replication::JobArtifactTransfer, :geo do
include ::EE::GeoHelpers
set(:primary_node) { create(:geo_node, :primary) }
set(:secondary_node) { create(:geo_node) }
set(:job_artifact) { create(:ci_job_artifact, :archive, :correct_checksum) }
let_it_be(:primary_node) { create(:geo_node, :primary) }
let_it_be(:secondary_node) { create(:geo_node) }
let_it_be(:job_artifact) { create(:ci_job_artifact, :archive, :correct_checksum) }
subject do
described_class.new(job_artifact)
......
......@@ -5,9 +5,9 @@ require 'spec_helper'
describe Gitlab::Geo::Replication::LfsTransfer do
include ::EE::GeoHelpers
set(:primary_node) { create(:geo_node, :primary) }
set(:secondary_node) { create(:geo_node) }
set(:lfs_object) { create(:lfs_object, :with_file, :correct_oid) }
let_it_be(:primary_node) { create(:geo_node, :primary) }
let_it_be(:secondary_node) { create(:geo_node) }
let_it_be(:lfs_object) { create(:lfs_object, :with_file, :correct_oid) }
subject do
described_class.new(lfs_object)
......
......@@ -6,8 +6,8 @@ describe Gitlab::Geo, :geo, :request_store do
using RSpec::Parameterized::TableSyntax
include ::EE::GeoHelpers
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) }
shared_examples 'a Geo cached value' do |method, key|
it 'includes GitLab version and Rails.version in the cache key' do
......
......@@ -4,8 +4,8 @@ require 'spec_helper'
describe Gitlab::GitAccessDesign do
include DesignManagementTestHelpers
set(:project) { create(:project) }
set(:user) { project.owner }
let_it_be(:project) { create(:project) }
let_it_be(:user) { project.owner }
let(:protocol) { 'web' }
let(:actor) { user }
......@@ -25,7 +25,7 @@ describe Gitlab::GitAccessDesign do
end
context "when the user is not allowed to manage designs" do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
it "raises an error " do
expect { subject }.to raise_error(::Gitlab::GitAccess::UnauthorizedError)
......
......@@ -6,7 +6,7 @@ describe Gitlab::GitAccess do
include GitHelpers
include EE::GeoHelpers
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
let(:actor) { user }
let(:project) { create(:project, :repository) }
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::GlRepository do
describe '.parse' do
set(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project, :repository) }
it 'parses a design gl_repository' do
expect(described_class.parse("design-#{project.id}")).to eq([project, EE::Gitlab::GlRepository::DESIGN])
......
......@@ -4,8 +4,8 @@ require 'spec_helper'
describe Gitlab::ImportExport::DesignRepoSaver do
describe 'bundle a design Git repo' do
set(:user) { create(:user) }
set(:design) { create(:design, :with_file, versions_count: 1) }
let_it_be(:user) { create(:user) }
let_it_be(:design) { create(:design, :with_file, versions_count: 1) }
let!(:project) { create(:project, :design_repo) }
let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" }
let(:shared) { project.import_export_shared }
......
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