Commit eb64d772 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'change-set-to-let-it-be-in-spec-services' into 'master'

Change set to let_it_be in spec/services

See merge request gitlab-org/gitlab!22533
parents 1d0764dd 97a7e72f
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe AutoMergeService do describe AutoMergeService 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) } let(:service) { described_class.new(project, user) }
describe '.all_strategies' do describe '.all_strategies' do
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe AwardEmojis::AddService do describe AwardEmojis::AddService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:awardable) { create(:note, project: project) } let_it_be(:awardable) { create(:note, project: project) }
let(:name) { 'thumbsup' } let(:name) { 'thumbsup' }
subject(:service) { described_class.new(awardable, name, user) } subject(:service) { described_class.new(awardable, name, user) }
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe AwardEmojis::DestroyService do describe AwardEmojis::DestroyService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:awardable) { create(:note) } let_it_be(:awardable) { create(:note) }
set(:project) { awardable.project } let_it_be(:project) { awardable.project }
let(:name) { 'thumbsup' } let(:name) { 'thumbsup' }
let!(:award_from_other_user) do let!(:award_from_other_user) do
create(:award_emoji, name: name, awardable: awardable, user: create(:user)) create(:award_emoji, name: name, awardable: awardable, user: create(:user))
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe AwardEmojis::ToggleService do describe AwardEmojis::ToggleService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
set(:awardable) { create(:note, project: project) } let_it_be(:awardable) { create(:note, project: project) }
let(:name) { 'thumbsup' } let(:name) { 'thumbsup' }
subject(:service) { described_class.new(awardable, name, user) } subject(:service) { described_class.new(awardable, name, user) }
......
...@@ -54,14 +54,14 @@ describe Boards::Issues::MoveService do ...@@ -54,14 +54,14 @@ describe Boards::Issues::MoveService do
end end
describe '#execute_multiple' do describe '#execute_multiple' do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, namespace: group) } let_it_be(:project) { create(:project, namespace: group) }
set(:board1) { create(:board, group: group) } let_it_be(:board1) { create(:board, group: group) }
set(:development) { create(:group_label, group: group, name: 'Development') } let_it_be(:development) { create(:group_label, group: group, name: 'Development') }
set(:testing) { create(:group_label, group: group, name: 'Testing') } let_it_be(:testing) { create(:group_label, group: group, name: 'Testing') }
set(:list1) { create(:list, board: board1, label: development, position: 0) } let_it_be(:list1) { create(:list, board: board1, label: development, position: 0) }
set(:list2) { create(:list, board: board1, label: testing, position: 1) } let_it_be(:list2) { create(:list, board: board1, label: testing, position: 1) }
let(:params) { { board_id: board1.id, from_list_id: list1.id, to_list_id: list2.id } } let(:params) { { board_id: board1.id, from_list_id: list1.id, to_list_id: list2.id } }
before do before do
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe Ci::CreatePipelineService do describe Ci::CreatePipelineService do
include ProjectForksHelper include ProjectForksHelper
set(:project) { create(:project, :repository) } let_it_be(:project, reload: true) { create(:project, :repository) }
let(:user) { create(:admin) } let(:user) { create(:admin) }
let(:ref_name) { 'refs/heads/master' } let(:ref_name) { 'refs/heads/master' }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe Ci::EnsureStageService, '#execute' do describe Ci::EnsureStageService, '#execute' do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:stage) { create(:ci_stage_entity) } let(:stage) { create(:ci_stage_entity) }
let(:job) { build(:ci_build) } let(:job) { build(:ci_build) }
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe Ci::ExpirePipelineCacheService do describe Ci::ExpirePipelineCacheService 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) }
subject { described_class.new } subject { described_class.new }
describe '#execute' do describe '#execute' do
......
...@@ -4,9 +4,9 @@ require 'spec_helper' ...@@ -4,9 +4,9 @@ require 'spec_helper'
module Ci module Ci
describe RegisterJobService do describe RegisterJobService do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:project) { create(:project, group: group, shared_runners_enabled: false, group_runners_enabled: false) } let_it_be(:project, reload: true) { create(:project, group: group, shared_runners_enabled: false, group_runners_enabled: false) }
set(:pipeline) { create(:ci_pipeline, project: project) } let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
let!(:shared_runner) { create(:ci_runner, :instance) } let!(:shared_runner) { create(:ci_runner, :instance) }
let!(:specific_runner) { create(:ci_runner, :project, projects: [project]) } let!(:specific_runner) { create(:ci_runner, :project, projects: [project]) }
let!(:group_runner) { create(:ci_runner, :group, groups: [group]) } let!(:group_runner) { create(:ci_runner, :group, groups: [group]) }
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe Ci::RetryBuildService do describe Ci::RetryBuildService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
set(:pipeline) do let_it_be(:pipeline) do
create(:ci_pipeline, project: project, create(:ci_pipeline, project: project,
sha: 'b83d6e391c22777fca1ed3012fce84f633d7fed0') sha: 'b83d6e391c22777fca1ed3012fce84f633d7fed0')
end end
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe ErrorTracking::ListIssuesService do describe ErrorTracking::ListIssuesService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:params) { { search_term: 'something', sort: 'last_seen', cursor: 'some-cursor' } } let(:params) { { search_term: 'something', sort: 'last_seen', cursor: 'some-cursor' } }
let(:list_sentry_issues_args) do let(:list_sentry_issues_args) do
{ {
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe ErrorTracking::ListProjectsService do describe ErrorTracking::ListProjectsService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project, reload: true) { create(:project) }
let(:sentry_url) { 'https://sentrytest.gitlab.com/api/0/projects/sentry-org/sentry-project' } let(:sentry_url) { 'https://sentrytest.gitlab.com/api/0/projects/sentry-org/sentry-project' }
let(:token) { 'test-token' } let(:token) { 'test-token' }
......
...@@ -4,8 +4,8 @@ require 'spec_helper' ...@@ -4,8 +4,8 @@ require 'spec_helper'
describe ExternalPullRequests::CreatePipelineService do describe ExternalPullRequests::CreatePipelineService do
describe '#execute' do describe '#execute' do
set(:project) { create(:project, :auto_devops, :repository) } let_it_be(:project) { create(:project, :auto_devops, :repository) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:pull_request) { create(:external_pull_request, project: project) } let(:pull_request) { create(:external_pull_request, project: project) }
before do before do
......
...@@ -5,8 +5,8 @@ require 'spec_helper' ...@@ -5,8 +5,8 @@ require 'spec_helper'
describe Git::BranchPushService, services: true do describe Git::BranchPushService, services: true do
include RepoHelpers include RepoHelpers
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, :repository) } let_it_be(:project, reload: true) { create(:project, :repository) }
let(:blankrev) { Gitlab::Git::BLANK_SHA } let(:blankrev) { Gitlab::Git::BLANK_SHA }
let(:oldrev) { sample_commit.parent_id } let(:oldrev) { sample_commit.parent_id }
let(:newrev) { sample_commit.id } let(:newrev) { sample_commit.id }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
require 'spec_helper' require 'spec_helper'
describe Groups::AutoDevopsService, '#execute' do describe Groups::AutoDevopsService, '#execute' do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:group_params) { { auto_devops_enabled: '0' } } let(:group_params) { { auto_devops_enabled: '0' } }
let(:service) { described_class.new(group, user, group_params) } let(:service) { described_class.new(group, user, group_params) }
......
...@@ -15,16 +15,16 @@ describe Issues::ReferencedMergeRequestsService do ...@@ -15,16 +15,16 @@ describe Issues::ReferencedMergeRequestsService do
end end
end end
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, :public, :repository) } let_it_be(:project) { create(:project, :public, :repository) }
set(:other_project) { create(:project, :public, :repository) } let_it_be(:other_project) { create(:project, :public, :repository) }
set(:issue) { create(:issue, author: user, project: project) } let_it_be(:issue) { create(:issue, author: user, project: project) }
set(:closing_mr) { create_closing_mr(source_project: project) } let_it_be(:closing_mr) { create_closing_mr(source_project: project) }
set(:closing_mr_other_project) { create_closing_mr(source_project: other_project) } let_it_be(:closing_mr_other_project) { create_closing_mr(source_project: other_project) }
set(:referencing_mr) { create_referencing_mr(source_project: project, source_branch: 'csv') } let_it_be(:referencing_mr) { create_referencing_mr(source_project: project, source_branch: 'csv') }
set(:referencing_mr_other_project) { create_referencing_mr(source_project: other_project, source_branch: 'csv') } let_it_be(:referencing_mr_other_project) { create_referencing_mr(source_project: other_project, source_branch: 'csv') }
let(:service) { described_class.new(project, user) } let(:service) { described_class.new(project, user) }
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe Issues::ReorderService do describe Issues::ReorderService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
shared_examples 'issues reorder service' do shared_examples 'issues reorder service' do
context 'when reordering issues' do context 'when reordering issues' do
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe Issues::ZoomLinkService do describe Issues::ZoomLinkService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:issue) { create(:issue) } let_it_be(:issue) { create(:issue) }
let(:project) { issue.project } let(:project) { issue.project }
let(:service) { described_class.new(issue, user) } let(:service) { described_class.new(issue, user) }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe MergeRequests::CreatePipelineService do describe MergeRequests::CreatePipelineService do
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
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) }
let(:params) { {} } let(:params) { {} }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe MergeRequests::MergeService do describe MergeRequests::MergeService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:user2) { create(:user) } let_it_be(:user2) { create(:user) }
let(:merge_request) { create(:merge_request, :simple, author: user2, assignees: [user2]) } let(:merge_request) { create(:merge_request, :simple, author: user2, assignees: [user2]) }
let(:project) { merge_request.project } let(:project) { merge_request.project }
......
...@@ -67,7 +67,7 @@ describe MergeRequests::MergeToRefService do ...@@ -67,7 +67,7 @@ describe MergeRequests::MergeToRefService do
end end
end end
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:merge_request) { create(:merge_request, :simple) } let(:merge_request) { create(:merge_request, :simple) }
let(:project) { merge_request.project } let(:project) { merge_request.project }
...@@ -214,7 +214,7 @@ describe MergeRequests::MergeToRefService do ...@@ -214,7 +214,7 @@ describe MergeRequests::MergeToRefService do
end end
describe 'cascading merge refs' do describe 'cascading merge refs' do
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let(:params) { { commit_message: 'Cascading merge', first_parent_ref: first_parent_ref, target_ref: target_ref, sha: merge_request.diff_head_sha } } let(:params) { { commit_message: 'Cascading merge', first_parent_ref: first_parent_ref, target_ref: target_ref, sha: merge_request.diff_head_sha } }
context 'when first merge happens' do context 'when first merge happens' do
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe Metrics::Dashboard::CustomMetricEmbedService do describe Metrics::Dashboard::CustomMetricEmbedService do
include MetricsDashboardHelpers include MetricsDashboardHelpers
set(:project) { build(:project) } let_it_be(:project, reload: true) { build(: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) }
before do before do
project.add_maintainer(user) project.add_maintainer(user)
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe Metrics::Dashboard::DefaultEmbedService, :use_clean_rails_memory_store_caching do describe Metrics::Dashboard::DefaultEmbedService, :use_clean_rails_memory_store_caching do
include MetricsDashboardHelpers include MetricsDashboardHelpers
set(:project) { build(:project) } let_it_be(:project) { build(: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) }
before do before do
project.add_maintainer(user) project.add_maintainer(user)
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe Metrics::Dashboard::DynamicEmbedService, :use_clean_rails_memory_store_caching do describe Metrics::Dashboard::DynamicEmbedService, :use_clean_rails_memory_store_caching do
include MetricsDashboardHelpers include MetricsDashboardHelpers
set(:project) { build(:project) } let_it_be(:project) { build(: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) }
before do before do
project.add_maintainer(user) project.add_maintainer(user)
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe Metrics::Dashboard::ProjectDashboardService, :use_clean_rails_memory_store_caching do describe Metrics::Dashboard::ProjectDashboardService, :use_clean_rails_memory_store_caching do
include MetricsDashboardHelpers include MetricsDashboardHelpers
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:environment) { create(:environment, project: project) } let_it_be(:environment) { create(:environment, project: project) }
before do before do
project.add_maintainer(user) project.add_maintainer(user)
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe Metrics::Dashboard::SystemDashboardService, :use_clean_rails_memory_store_caching do describe Metrics::Dashboard::SystemDashboardService, :use_clean_rails_memory_store_caching do
include MetricsDashboardHelpers include MetricsDashboardHelpers
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:environment) { create(:environment, project: project) } let_it_be(:environment) { create(:environment, project: project) }
before do before do
project.add_maintainer(user) project.add_maintainer(user)
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe Notes::CreateService do describe Notes::CreateService do
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
set(:issue) { create(:issue, project: project) } let_it_be(:issue) { create(:issue, project: project) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:opts) do let(:opts) do
{ note: 'Awesome comment', noteable_type: 'Issue', noteable_id: issue.id } { note: 'Awesome comment', noteable_type: 'Issue', noteable_id: issue.id }
end end
...@@ -216,12 +216,12 @@ describe Notes::CreateService do ...@@ -216,12 +216,12 @@ describe Notes::CreateService do
context 'note with commands' do context 'note with commands' do
context 'all quick actions' do context 'all quick actions' do
set(:milestone) { create(:milestone, project: project, title: "sprint") } let_it_be(:milestone) { create(:milestone, project: project, title: "sprint") }
set(:bug_label) { create(:label, project: project, title: 'bug') } let_it_be(:bug_label) { create(:label, project: project, title: 'bug') }
set(:to_be_copied_label) { create(:label, project: project, title: 'to be copied') } let_it_be(:to_be_copied_label) { create(:label, project: project, title: 'to be copied') }
set(:feature_label) { create(:label, project: project, title: 'feature') } let_it_be(:feature_label) { create(:label, project: project, title: 'feature') }
set(:issue) { create(:issue, project: project, labels: [bug_label], due_date: '2019-01-01') } let_it_be(:issue, reload: true) { create(:issue, project: project, labels: [bug_label], due_date: '2019-01-01') }
set(:issue_2) { create(:issue, project: project, labels: [bug_label, to_be_copied_label]) } let_it_be(:issue_2) { create(:issue, project: project, labels: [bug_label, to_be_copied_label]) }
context 'for issues' do context 'for issues' do
let(:issuable) { issue } let(:issuable) { issue }
...@@ -272,7 +272,7 @@ describe Notes::CreateService do ...@@ -272,7 +272,7 @@ describe Notes::CreateService do
end end
context 'for merge requests' do context 'for merge requests' do
set(:merge_request) { create(:merge_request, source_project: project, labels: [bug_label]) } let_it_be(:merge_request) { create(:merge_request, source_project: project, labels: [bug_label]) }
let(:issuable) { merge_request } let(:issuable) { merge_request }
let(:note_params) { opts.merge(noteable_type: 'MergeRequest', noteable_id: merge_request.id) } let(:note_params) { opts.merge(noteable_type: 'MergeRequest', noteable_id: merge_request.id) }
let(:merge_request_quick_actions) do let(:merge_request_quick_actions) do
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe Notes::DestroyService do describe Notes::DestroyService do
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) }
let(:user) { issue.author } let(:user) { issue.author }
describe '#execute' do describe '#execute' do
......
...@@ -155,7 +155,7 @@ describe NotificationService, :mailer do ...@@ -155,7 +155,7 @@ describe NotificationService, :mailer do
describe '#async' do describe '#async' do
let(:async) { notification.async } let(:async) { notification.async }
set(:key) { create(:personal_key) } let_it_be(:key) { create(:personal_key) }
it 'returns an Async object with the correct parent' do it 'returns an Async object with the correct parent' do
expect(async).to be_a(described_class::Async) expect(async).to be_a(described_class::Async)
...@@ -2508,14 +2508,14 @@ describe NotificationService, :mailer do ...@@ -2508,14 +2508,14 @@ describe NotificationService, :mailer do
end end
describe 'Pages domains' do describe 'Pages domains' do
set(:project) { create(:project) } let_it_be(:project, reload: true) { create(:project) }
set(:domain) { create(:pages_domain, project: project) } let_it_be(:domain, reload: true) { create(:pages_domain, project: project) }
set(:u_blocked) { create(:user, :blocked) } let_it_be(:u_blocked) { create(:user, :blocked) }
set(:u_silence) { create_user_with_notification(:disabled, 'silent', project) } let_it_be(:u_silence) { create_user_with_notification(:disabled, 'silent', project) }
set(:u_owner) { project.owner } let_it_be(:u_owner) { project.owner }
set(:u_maintainer1) { create(:user) } let_it_be(:u_maintainer1) { create(:user) }
set(:u_maintainer2) { create(:user) } let_it_be(:u_maintainer2) { create(:user) }
set(:u_developer) { create(:user) } let_it_be(:u_developer) { create(:user) }
before do before do
project.add_maintainer(u_blocked) project.add_maintainer(u_blocked)
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe Projects::ContainerRepository::CleanupTagsService do describe Projects::ContainerRepository::CleanupTagsService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, :private) } let_it_be(:project) { create(:project, :private) }
set(:repository) { create(:container_repository, :root, project: project) } let_it_be(:repository) { create(:container_repository, :root, project: project) }
let(:service) { described_class.new(project, user, params) } let(:service) { described_class.new(project, user, params) }
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe Projects::ContainerRepository::DeleteTagsService do describe Projects::ContainerRepository::DeleteTagsService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, :private) } let_it_be(:project) { create(:project, :private) }
set(:repository) { create(:container_repository, :root, project: project) } let_it_be(:repository) { create(:container_repository, :root, project: project) }
let(:params) { { tags: tags } } let(:params) { { tags: tags } }
let(:service) { described_class.new(project, user, params) } let(:service) { described_class.new(project, user, params) }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe Projects::ContainerRepository::DestroyService do describe Projects::ContainerRepository::DestroyService do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, :private) } let_it_be(:project) { create(:project, :private) }
subject { described_class.new(project, user) } subject { described_class.new(project, user) }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe Projects::DetectRepositoryLanguagesService, :clean_gitlab_redis_shared_state do describe Projects::DetectRepositoryLanguagesService, :clean_gitlab_redis_shared_state do
set(:project) { create(:project, :repository) } let_it_be(:project, reload: true) { create(:project, :repository) }
subject { described_class.new(project) } subject { described_class.new(project) }
...@@ -51,7 +51,7 @@ describe Projects::DetectRepositoryLanguagesService, :clean_gitlab_redis_shared_ ...@@ -51,7 +51,7 @@ describe Projects::DetectRepositoryLanguagesService, :clean_gitlab_redis_shared_
end end
context 'when no repository exists' do context 'when no repository exists' do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
it 'has no languages' do it 'has no languages' do
expect(subject.execute).to be_empty expect(subject.execute).to be_empty
......
...@@ -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(:file) { fixture_file_upload('spec/fixtures/project_export.tar.gz') } let(:file) { fixture_file_upload('spec/fixtures/project_export.tar.gz') }
let(:overwrite) { false } let(:overwrite) { false }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe Projects::HousekeepingService do describe Projects::HousekeepingService do
subject { described_class.new(project) } subject { described_class.new(project) }
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
before do before do
project.reset_pushes_since_gc project.reset_pushes_since_gc
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe Projects::OpenMergeRequestsCountService, :use_clean_rails_memory_store_caching do describe Projects::OpenMergeRequestsCountService, :use_clean_rails_memory_store_caching do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
subject { described_class.new(project) } subject { described_class.new(project) }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
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) }
set(:project) { create(:project) } let_it_be(:project, reload: true) { create(:project) }
let(:result) { subject.execute } let(:result) { subject.execute }
......
...@@ -4,8 +4,8 @@ require 'spec_helper' ...@@ -4,8 +4,8 @@ require 'spec_helper'
describe Projects::ParticipantsService do describe Projects::ParticipantsService do
describe '#groups' do describe '#groups' do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, :public) } let_it_be(:project) { create(:project, :public) }
let(:service) { described_class.new(project, user) } let(:service) { described_class.new(project, user) }
it 'avoids N+1 queries' do it 'avoids N+1 queries' do
...@@ -62,10 +62,10 @@ describe Projects::ParticipantsService do ...@@ -62,10 +62,10 @@ describe Projects::ParticipantsService do
subject(:usernames) { service.project_members.map { |member| member[:username] } } subject(:usernames) { service.project_members.map { |member| member[:username] } }
context 'when there is a project in group namespace' do context 'when there is a project in group namespace' do
set(:public_group) { create(:group, :public) } let_it_be(:public_group) { create(:group, :public) }
set(:public_project) { create(:project, :public, namespace: public_group)} let_it_be(:public_project) { create(:project, :public, namespace: public_group)}
set(:public_group_owner) { create(:user) } let_it_be(:public_group_owner) { create(:user) }
let(:service) { described_class.new(public_project, create(:user)) } let(:service) { described_class.new(public_project, create(:user)) }
...@@ -79,18 +79,18 @@ describe Projects::ParticipantsService do ...@@ -79,18 +79,18 @@ describe Projects::ParticipantsService do
end end
context 'when there is a private group and a public project' do context 'when there is a private group and a public project' do
set(:public_group) { create(:group, :public) } let_it_be(:public_group) { create(:group, :public) }
set(:private_group) { create(:group, :private, :nested) } let_it_be(:private_group) { create(:group, :private, :nested) }
set(:public_project) { create(:project, :public, namespace: public_group)} let_it_be(:public_project) { create(:project, :public, namespace: public_group)}
set(:project_issue) { create(:issue, project: public_project)} let_it_be(:project_issue) { create(:issue, project: public_project)}
set(:public_group_owner) { create(:user) } let_it_be(:public_group_owner) { create(:user) }
set(:private_group_member) { create(:user) } let_it_be(:private_group_member) { create(:user) }
set(:public_project_maintainer) { create(:user) } let_it_be(:public_project_maintainer) { create(:user) }
set(:private_group_owner) { create(:user) } let_it_be(:private_group_owner) { create(:user) }
set(:group_ancestor_owner) { create(:user) } let_it_be(:group_ancestor_owner) { create(:user) }
before(:context) do before(:context) do
public_group.add_owner public_group_owner public_group.add_owner public_group_owner
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require "spec_helper" require "spec_helper"
describe Projects::UpdatePagesService do describe Projects::UpdatePagesService do
set(:project) { create(:project, :repository) } let_it_be(:project, refind: true) { create(:project, :repository) }
set(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit('HEAD').sha) } let_it_be(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit('HEAD').sha) }
set(:build) { create(:ci_build, pipeline: pipeline, ref: 'HEAD') } let_it_be(:build) { create(:ci_build, pipeline: pipeline, ref: 'HEAD') }
let(:invalid_file) { fixture_file_upload('spec/fixtures/dk.png') } let(:invalid_file) { fixture_file_upload('spec/fixtures/dk.png') }
let(:file) { fixture_file_upload("spec/fixtures/pages.zip") } let(:file) { fixture_file_upload("spec/fixtures/pages.zip") }
......
...@@ -5,8 +5,8 @@ require 'spec_helper' ...@@ -5,8 +5,8 @@ require 'spec_helper'
describe Prometheus::ProxyService do describe Prometheus::ProxyService do
include ReactiveCachingHelpers include ReactiveCachingHelpers
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:environment) { create(:environment, project: project) } let_it_be(:environment) { create(:environment, project: project) }
describe 'configuration' do describe 'configuration' do
it 'ReactiveCaching refresh is not needed' do it 'ReactiveCaching refresh is not needed' do
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe ResourceEvents::ChangeLabelsService do describe ResourceEvents::ChangeLabelsService do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:author) { create(:user) } let_it_be(:author) { create(:user) }
let(:resource) { create(:issue, project: project) } let(:resource) { create(:issue, project: project) }
describe '.change_labels' do describe '.change_labels' do
......
...@@ -16,11 +16,11 @@ describe ResourceEvents::MergeIntoNotesService do ...@@ -16,11 +16,11 @@ describe ResourceEvents::MergeIntoNotesService do
create(:note_on_issue, opts.merge(params)) create(:note_on_issue, opts.merge(params))
end end
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:resource) { create(:issue, project: project) } let_it_be(:resource) { create(:issue, project: project) }
set(:label) { create(:label, project: project) } let_it_be(:label) { create(:label, project: project) }
set(:label2) { create(:label, project: project) } let_it_be(:label2) { create(:label, project: project) }
let(:time) { Time.now } let(:time) { Time.now }
describe '#execute' do describe '#execute' do
......
...@@ -7,9 +7,9 @@ describe SystemNoteService do ...@@ -7,9 +7,9 @@ describe SystemNoteService do
include RepoHelpers include RepoHelpers
include AssetsHelpers include AssetsHelpers
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:project) { create(:project, :repository, group: group) } let_it_be(:project) { create(:project, :repository, group: group) }
set(:author) { create(:user) } let_it_be(:author) { create(:user) }
let(:noteable) { create(:issue, project: project) } let(:noteable) { create(:issue, project: project) }
let(:issue) { noteable } let(:issue) { noteable }
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
require 'spec_helper' require 'spec_helper'
describe SystemNotes::CommitService do describe SystemNotes::CommitService do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:project) { create(:project, :repository, group: group) } let_it_be(:project) { create(:project, :repository, group: group) }
set(:author) { create(:user) } let_it_be(:author) { create(:user) }
let(:commit_service) { described_class.new(noteable: noteable, project: project, author: author) } let(:commit_service) { described_class.new(noteable: noteable, project: project, author: author) }
......
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