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' ...@@ -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
......
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