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