Commit f63426be authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'replace-set-to-let_it_be-in-specs-batch-5' into 'master'

Replace set to let_it_be in specs

See merge request gitlab-org/gitlab!25693
parents b38362f1 2b8bc704
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe BuildDetailsEntity do describe BuildDetailsEntity do
include ProjectForksHelper include ProjectForksHelper
set(:user) { create(:admin) } let_it_be(:user) { create(:admin) }
it 'inherits from JobEntity' do it 'inherits from JobEntity' do
expect(described_class).to be < JobEntity expect(described_class).to be < JobEntity
......
...@@ -3,14 +3,10 @@ ...@@ -3,14 +3,10 @@
require 'spec_helper' require 'spec_helper'
describe ContainerRepositoryEntity do describe ContainerRepositoryEntity do
let(:entity) do let_it_be(:project) { create(:project) }
described_class.new(repository, request: request) let_it_be(:user) { create(:user) }
end let_it_be(:repository) { create(:container_repository, project: project) }
let(:entity) { described_class.new(repository, request: request) }
set(:project) { create(:project) }
set(:user) { create(:user) }
set(:repository) { create(:container_repository, project: project) }
let(:request) { double('request') } let(:request) { double('request') }
subject { entity.as_json } subject { entity.as_json }
......
...@@ -3,14 +3,10 @@ ...@@ -3,14 +3,10 @@
require 'spec_helper' require 'spec_helper'
describe ContainerTagEntity do describe ContainerTagEntity do
let(:entity) do let_it_be(:project) { create(:project) }
described_class.new(tag, request: request) let_it_be(:user) { create(:user) }
end let_it_be(:repository) { create(:container_repository, name: 'image', project: project) }
let(:entity) { described_class.new(tag, request: request) }
set(:project) { create(:project) }
set(:user) { create(:user) }
set(:repository) { create(:container_repository, name: 'image', project: project) }
let(:request) { double('request') } let(:request) { double('request') }
let(:tag) { repository.tag('test') } let(:tag) { repository.tag('test') }
......
...@@ -3,9 +3,8 @@ ...@@ -3,9 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe DeploymentSerializer do describe DeploymentSerializer do
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
set(:user) { create(:user, email: project.commit.author_email) } let_it_be(:user) { create(:user, email: project.commit.author_email) }
let(:resource) { create(:deployment, project: project, sha: project.commit.id) } let(:resource) { create(:deployment, project: project, sha: project.commit.id) }
let(:serializer) { described_class.new(request) } let(:serializer) { described_class.new(request) }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe MergeRequestSerializer do describe MergeRequestSerializer do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:resource) { create(:merge_request, description: "Description") } let_it_be(:resource) { create(:merge_request, description: "Description") }
let(:json_entity) do let(:json_entity) do
described_class.new(current_user: user) described_class.new(current_user: user)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe NamespaceBasicEntity do describe NamespaceBasicEntity do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
let(:entity) do let(:entity) do
described_class.represent(group) described_class.represent(group)
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe PipelineDetailsEntity do describe PipelineDetailsEntity do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:request) { double('request') } let(:request) { double('request') }
it 'inherrits from PipelineEntity' do it 'inherrits from PipelineEntity' do
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe PipelineEntity do describe PipelineEntity do
include Gitlab::Routing include Gitlab::Routing
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:request) { double('request') } let(:request) { double('request') }
before do before do
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe PipelineSerializer do describe PipelineSerializer do
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:serializer) do let(:serializer) do
described_class.new(current_user: user, project: project) described_class.new(current_user: user, project: project)
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe ProjectImportEntity do describe ProjectImportEntity do
include ImportHelper include ImportHelper
set(:project) { create(:project, import_status: :started, import_source: 'namespace/project') } let_it_be(:project) { create(:project, import_status: :started, import_source: 'namespace/project') }
let(:provider_url) { 'https://provider.com' } let(:provider_url) { 'https://provider.com' }
let(:entity) { described_class.represent(project, provider_url: provider_url) } let(:entity) { described_class.represent(project, provider_url: provider_url) }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe ProjectSerializer do describe ProjectSerializer do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:provider_url) { 'http://provider.com' } let(:provider_url) { 'http://provider.com' }
context 'when serializer option is :import' do context 'when serializer option is :import' do
......
...@@ -3,11 +3,10 @@ ...@@ -3,11 +3,10 @@
require 'rake_helper' require 'rake_helper'
describe 'gitlab:web_hook namespace rake tasks' do describe 'gitlab:web_hook namespace rake tasks' do
set(:group) { create(:group) } let_it_be(:group, refind: true) { create(:group) }
let_it_be(:project1, reload: true) { create(:project, namespace: group) }
set(:project1) { create(:project, namespace: group) } let_it_be(:project2, reload: true) { create(:project, namespace: group) }
set(:project2) { create(:project, namespace: group) } let_it_be(:other_group_project, reload: true) { create(:project) }
set(:other_group_project) { create(:project) }
let(:url) { 'http://example.com' } let(:url) { 'http://example.com' }
let(:hook_urls) { (project1.hooks + project2.hooks).map(&:url) } let(:hook_urls) { (project1.hooks + project2.hooks).map(&:url) }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe 'shared/milestones/_top.html.haml' do describe 'shared/milestones/_top.html.haml' do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
let(:project) { create(:project, group: group) } let(:project) { create(:project, group: group) }
let(:milestone) { create(:milestone, project: project) } let(:milestone) { create(:milestone, project: project) }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe DetectRepositoryLanguagesWorker do describe DetectRepositoryLanguagesWorker do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
subject { described_class.new } subject { described_class.new }
......
...@@ -31,7 +31,7 @@ describe ExpireBuildInstanceArtifactsWorker do ...@@ -31,7 +31,7 @@ describe ExpireBuildInstanceArtifactsWorker do
end end
context 'with not yet expired artifacts' do context 'with not yet expired artifacts' do
set(:build) do let_it_be(:build) do
create(:ci_build, :artifacts, artifacts_expire_at: Time.now + 7.days) create(:ci_build, :artifacts, artifacts_expire_at: Time.now + 7.days)
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe ExpireJobCacheWorker do describe ExpireJobCacheWorker do
set(:pipeline) { create(:ci_empty_pipeline) } let_it_be(:pipeline) { create(:ci_empty_pipeline) }
let(:project) { pipeline.project } let(:project) { pipeline.project }
describe '#perform' do describe '#perform' do
......
...@@ -6,7 +6,7 @@ describe MailScheduler::NotificationServiceWorker do ...@@ -6,7 +6,7 @@ describe MailScheduler::NotificationServiceWorker do
let(:worker) { described_class.new } let(:worker) { described_class.new }
let(:method) { 'new_key' } let(:method) { 'new_key' }
set(:key) { create(:personal_key) } let_it_be(:key) { create(:personal_key) }
def serialize(*args) def serialize(*args)
ActiveJob::Arguments.serialize(args) ActiveJob::Arguments.serialize(args)
......
...@@ -7,8 +7,8 @@ describe PipelineScheduleWorker do ...@@ -7,8 +7,8 @@ describe PipelineScheduleWorker do
subject { described_class.new.perform } subject { described_class.new.perform }
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let!(:pipeline_schedule) do let!(:pipeline_schedule) do
create(:ci_pipeline_schedule, :nightly, project: project, owner: user) create(:ci_pipeline_schedule, :nightly, project: project, owner: user)
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe RemoteMirrorNotificationWorker, :mailer do describe RemoteMirrorNotificationWorker, :mailer do
set(:project) { create(:project, :repository, :remote_mirror) } let_it_be(:project) { create(:project, :repository, :remote_mirror) }
set(:mirror) { project.remote_mirrors.first } let_it_be(:mirror) { project.remote_mirrors.first }
describe '#execute' do describe '#execute' do
it 'calls NotificationService#remote_mirror_update_failed when the mirror exists' do it 'calls NotificationService#remote_mirror_update_failed when the mirror exists' do
......
...@@ -4,9 +4,9 @@ require 'spec_helper' ...@@ -4,9 +4,9 @@ require 'spec_helper'
describe RunPipelineScheduleWorker do describe RunPipelineScheduleWorker do
describe '#perform' do describe '#perform' do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project ) } let_it_be(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project ) }
let(:worker) { described_class.new } let(:worker) { described_class.new }
context 'when a project not found' do context 'when a project not found' do
......
...@@ -4,8 +4,8 @@ require 'spec_helper' ...@@ -4,8 +4,8 @@ require 'spec_helper'
describe UpdateExternalPullRequestsWorker do describe UpdateExternalPullRequestsWorker do
describe '#perform' do describe '#perform' do
set(:project) { create(:project, import_source: 'tanuki/repository') } let_it_be(:project) { create(:project, import_source: 'tanuki/repository') }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:worker) { described_class.new } let(:worker) { described_class.new }
before do before do
......
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