Commit 387885e5 authored by Vitali Tatarintev's avatar Vitali Tatarintev Committed by Heinrich Lee Yu

Replace set with let_it_be in spec/serializers

Removes usage of `set` in specs
parent 3dcccdce
......@@ -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
......
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