Commit 308e8f7e authored by Vitali Tatarintev's avatar Vitali Tatarintev

Replace set with let_it_be in spec/graphql

Removes usage of `set` in specs
parent 11a40cc8
...@@ -5,8 +5,7 @@ require 'spec_helper' ...@@ -5,8 +5,7 @@ require 'spec_helper'
describe 'Gitlab::Graphql::Authorization' do describe 'Gitlab::Graphql::Authorization' do
include GraphqlHelpers include GraphqlHelpers
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:permission_single) { :foo } let(:permission_single) { :foo }
let(:permission_collection) { [:foo, :bar] } let(:permission_collection) { [:foo, :bar] }
let(:test_object) { double(name: 'My name') } let(:test_object) { double(name: 'My name') }
......
...@@ -17,11 +17,11 @@ describe ResolvesPipelines do ...@@ -17,11 +17,11 @@ describe ResolvesPipelines do
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
set(:project) { create(:project, :private) } let_it_be(:project) { create(:project, :private) }
set(:pipeline) { create(:ci_pipeline, project: project) } let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
set(:failed_pipeline) { create(:ci_pipeline, :failed, project: project) } let_it_be(:failed_pipeline) { create(:ci_pipeline, :failed, project: project) }
set(:ref_pipeline) { create(:ci_pipeline, project: project, ref: 'awesome-feature') } let_it_be(:ref_pipeline) { create(:ci_pipeline, project: project, ref: 'awesome-feature') }
set(:sha_pipeline) { create(:ci_pipeline, project: project, sha: 'deadbeef') } let_it_be(:sha_pipeline) { create(:ci_pipeline, project: project, sha: 'deadbeef') }
before do before do
project.add_developer(current_user) project.add_developer(current_user)
......
...@@ -5,8 +5,8 @@ require 'spec_helper' ...@@ -5,8 +5,8 @@ require 'spec_helper'
describe Resolvers::GroupResolver do describe Resolvers::GroupResolver do
include GraphqlHelpers include GraphqlHelpers
set(:group1) { create(:group) } let_it_be(:group1) { create(:group) }
set(:group2) { create(:group) } let_it_be(:group2) { create(:group) }
describe '#resolve' do describe '#resolve' do
it 'batch-resolves groups by full path' do it 'batch-resolves groups by full path' do
......
...@@ -8,11 +8,11 @@ describe Resolvers::IssuesResolver do ...@@ -8,11 +8,11 @@ describe Resolvers::IssuesResolver do
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
context "with a project" do context "with a project" do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:issue1) { create(:issue, project: project, state: :opened, created_at: 3.hours.ago, updated_at: 3.hours.ago) } let_it_be(:issue1) { create(:issue, project: project, state: :opened, created_at: 3.hours.ago, updated_at: 3.hours.ago) }
set(:issue2) { create(:issue, project: project, state: :closed, title: 'foo', created_at: 1.hour.ago, updated_at: 1.hour.ago, closed_at: 1.hour.ago) } let_it_be(:issue2) { create(:issue, project: project, state: :closed, title: 'foo', created_at: 1.hour.ago, updated_at: 1.hour.ago, closed_at: 1.hour.ago) }
set(:label1) { create(:label, project: project) } let_it_be(:label1) { create(:label, project: project) }
set(:label2) { create(:label, project: project) } let_it_be(:label2) { create(:label, project: project) }
before do before do
project.add_developer(current_user) project.add_developer(current_user)
......
...@@ -5,8 +5,8 @@ require 'spec_helper' ...@@ -5,8 +5,8 @@ require 'spec_helper'
describe Resolvers::MergeRequestPipelinesResolver do describe Resolvers::MergeRequestPipelinesResolver do
include GraphqlHelpers include GraphqlHelpers
set(:merge_request) { create(:merge_request) } let_it_be(:merge_request) { create(:merge_request) }
set(:pipeline) do let_it_be(:pipeline) do
create( create(
:ci_pipeline, :ci_pipeline,
project: merge_request.source_project, project: merge_request.source_project,
...@@ -14,8 +14,8 @@ describe Resolvers::MergeRequestPipelinesResolver do ...@@ -14,8 +14,8 @@ describe Resolvers::MergeRequestPipelinesResolver do
sha: merge_request.diff_head_sha sha: merge_request.diff_head_sha
) )
end end
set(:other_project_pipeline) { create(:ci_pipeline, project: merge_request.source_project) } let_it_be(:other_project_pipeline) { create(:ci_pipeline, project: merge_request.source_project) }
set(:other_pipeline) { create(:ci_pipeline) } let_it_be(:other_pipeline) { create(:ci_pipeline) }
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
before do before do
......
...@@ -5,16 +5,13 @@ require 'spec_helper' ...@@ -5,16 +5,13 @@ require 'spec_helper'
describe Resolvers::MergeRequestsResolver do describe Resolvers::MergeRequestsResolver do
include GraphqlHelpers include GraphqlHelpers
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
set(:merge_request_1) { create(:merge_request, :simple, source_project: project, target_project: project) } let_it_be(:merge_request_1) { create(:merge_request, :simple, source_project: project, target_project: project) }
set(:merge_request_2) { create(:merge_request, :rebased, source_project: project, target_project: project) } let_it_be(:merge_request_2) { create(:merge_request, :rebased, source_project: project, target_project: project) }
let_it_be(:other_project) { create(:project, :repository) }
set(:other_project) { create(:project, :repository) } let_it_be(:other_merge_request) { create(:merge_request, source_project: other_project, target_project: other_project) }
set(:other_merge_request) { create(:merge_request, source_project: other_project, target_project: other_project) }
let(:iid_1) { merge_request_1.iid } let(:iid_1) { merge_request_1.iid }
let(:iid_2) { merge_request_2.iid } let(:iid_2) { merge_request_2.iid }
let(:other_iid) { other_merge_request.iid } let(:other_iid) { other_merge_request.iid }
describe '#resolve' do describe '#resolve' do
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe Resolvers::ProjectPipelinesResolver do describe Resolvers::ProjectPipelinesResolver do
include GraphqlHelpers include GraphqlHelpers
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) }
set(:other_pipeline) { create(:ci_pipeline) } let_it_be(:other_pipeline) { create(:ci_pipeline) }
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
before do before do
......
...@@ -5,10 +5,9 @@ require 'spec_helper' ...@@ -5,10 +5,9 @@ require 'spec_helper'
describe Resolvers::ProjectResolver do describe Resolvers::ProjectResolver do
include GraphqlHelpers include GraphqlHelpers
set(:project1) { create(:project) } let_it_be(:project1) { create(:project) }
set(:project2) { create(:project) } let_it_be(:project2) { create(:project) }
let_it_be(:other_project) { create(:project) }
set(:other_project) { create(:project) }
describe '#resolve' do describe '#resolve' do
it 'batch-resolves projects by full path' do it 'batch-resolves projects by full path' 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