diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 15:08:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 15:08:51 +0000 |
commit | 163a7046ac76eb4109184e82ce0af911633e6626 (patch) | |
tree | 9f22bb438db435d518e8f5520b309c6319ae0bd8 /spec/graphql | |
parent | 0637ba1e6e9024f35b2cbf561d9002ec17350bb3 (diff) | |
download | gitlab-ce-163a7046ac76eb4109184e82ce0af911633e6626.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql')
8 files changed, 28 insertions, 33 deletions
diff --git a/spec/graphql/features/authorization_spec.rb b/spec/graphql/features/authorization_spec.rb index 5ef1bced179..44f47e6c739 100644 --- a/spec/graphql/features/authorization_spec.rb +++ b/spec/graphql/features/authorization_spec.rb @@ -5,8 +5,7 @@ require 'spec_helper' describe 'Gitlab::Graphql::Authorization' do include GraphqlHelpers - set(:user) { create(:user) } - + let_it_be(:user) { create(:user) } let(:permission_single) { :foo } let(:permission_collection) { [:foo, :bar] } let(:test_object) { double(name: 'My name') } diff --git a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb index b59561ebdd4..03ff1e11d85 100644 --- a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb +++ b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb @@ -17,11 +17,11 @@ describe ResolvesPipelines do let(:current_user) { create(:user) } - set(:project) { create(:project, :private) } - set(:pipeline) { create(:ci_pipeline, project: project) } - set(:failed_pipeline) { create(:ci_pipeline, :failed, project: project) } - set(:ref_pipeline) { create(:ci_pipeline, project: project, ref: 'awesome-feature') } - set(:sha_pipeline) { create(:ci_pipeline, project: project, sha: 'deadbeef') } + let_it_be(:project) { create(:project, :private) } + let_it_be(:pipeline) { create(:ci_pipeline, project: project) } + let_it_be(:failed_pipeline) { create(:ci_pipeline, :failed, project: project) } + let_it_be(:ref_pipeline) { create(:ci_pipeline, project: project, ref: 'awesome-feature') } + let_it_be(:sha_pipeline) { create(:ci_pipeline, project: project, sha: 'deadbeef') } before do project.add_developer(current_user) diff --git a/spec/graphql/resolvers/group_resolver_spec.rb b/spec/graphql/resolvers/group_resolver_spec.rb index 7dec9ac1aa5..70b1102d363 100644 --- a/spec/graphql/resolvers/group_resolver_spec.rb +++ b/spec/graphql/resolvers/group_resolver_spec.rb @@ -5,8 +5,8 @@ require 'spec_helper' describe Resolvers::GroupResolver do include GraphqlHelpers - set(:group1) { create(:group) } - set(:group2) { create(:group) } + let_it_be(:group1) { create(:group) } + let_it_be(:group2) { create(:group) } describe '#resolve' do it 'batch-resolves groups by full path' do diff --git a/spec/graphql/resolvers/issues_resolver_spec.rb b/spec/graphql/resolvers/issues_resolver_spec.rb index 9e75a6cad60..3fbb7280465 100644 --- a/spec/graphql/resolvers/issues_resolver_spec.rb +++ b/spec/graphql/resolvers/issues_resolver_spec.rb @@ -8,11 +8,11 @@ describe Resolvers::IssuesResolver do let(:current_user) { create(:user) } context "with a project" do - set(:project) { create(:project) } - set(: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) } - set(:label1) { create(:label, project: project) } - set(:label2) { create(:label, project: project) } + let_it_be(:project) { create(:project) } + let_it_be(:issue1) { create(:issue, project: project, state: :opened, created_at: 3.hours.ago, updated_at: 3.hours.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) } + let_it_be(:label1) { create(:label, project: project) } + let_it_be(:label2) { create(:label, project: project) } before do project.add_developer(current_user) diff --git a/spec/graphql/resolvers/merge_request_pipelines_resolver_spec.rb b/spec/graphql/resolvers/merge_request_pipelines_resolver_spec.rb index b8bdfc36ba7..02c6409a9a6 100644 --- a/spec/graphql/resolvers/merge_request_pipelines_resolver_spec.rb +++ b/spec/graphql/resolvers/merge_request_pipelines_resolver_spec.rb @@ -5,8 +5,8 @@ require 'spec_helper' describe Resolvers::MergeRequestPipelinesResolver do include GraphqlHelpers - set(:merge_request) { create(:merge_request) } - set(:pipeline) do + let_it_be(:merge_request) { create(:merge_request) } + let_it_be(:pipeline) do create( :ci_pipeline, project: merge_request.source_project, @@ -14,8 +14,8 @@ describe Resolvers::MergeRequestPipelinesResolver do sha: merge_request.diff_head_sha ) end - set(:other_project_pipeline) { create(:ci_pipeline, project: merge_request.source_project) } - set(:other_pipeline) { create(:ci_pipeline) } + let_it_be(:other_project_pipeline) { create(:ci_pipeline, project: merge_request.source_project) } + let_it_be(:other_pipeline) { create(:ci_pipeline) } let(:current_user) { create(:user) } before do diff --git a/spec/graphql/resolvers/merge_requests_resolver_spec.rb b/spec/graphql/resolvers/merge_requests_resolver_spec.rb index fe167a6ae3e..0bd5043d855 100644 --- a/spec/graphql/resolvers/merge_requests_resolver_spec.rb +++ b/spec/graphql/resolvers/merge_requests_resolver_spec.rb @@ -5,16 +5,13 @@ require 'spec_helper' describe Resolvers::MergeRequestsResolver do include GraphqlHelpers - set(:project) { create(:project, :repository) } - set(: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) } - - set(:other_project) { create(:project, :repository) } - set(:other_merge_request) { create(:merge_request, source_project: other_project, target_project: other_project) } - + let_it_be(:project) { create(:project, :repository) } + let_it_be(:merge_request_1) { create(:merge_request, :simple, 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) } + let_it_be(:other_merge_request) { create(:merge_request, source_project: other_project, target_project: other_project) } let(:iid_1) { merge_request_1.iid } let(:iid_2) { merge_request_2.iid } - let(:other_iid) { other_merge_request.iid } describe '#resolve' do diff --git a/spec/graphql/resolvers/project_pipelines_resolver_spec.rb b/spec/graphql/resolvers/project_pipelines_resolver_spec.rb index f312a118c96..2a14796fdfa 100644 --- a/spec/graphql/resolvers/project_pipelines_resolver_spec.rb +++ b/spec/graphql/resolvers/project_pipelines_resolver_spec.rb @@ -5,9 +5,9 @@ require 'spec_helper' describe Resolvers::ProjectPipelinesResolver do include GraphqlHelpers - set(:project) { create(:project) } - set(:pipeline) { create(:ci_pipeline, project: project) } - set(:other_pipeline) { create(:ci_pipeline) } + let_it_be(:project) { create(:project) } + let_it_be(:pipeline) { create(:ci_pipeline, project: project) } + let_it_be(:other_pipeline) { create(:ci_pipeline) } let(:current_user) { create(:user) } before do diff --git a/spec/graphql/resolvers/project_resolver_spec.rb b/spec/graphql/resolvers/project_resolver_spec.rb index 860f8b4abb8..e9e38353156 100644 --- a/spec/graphql/resolvers/project_resolver_spec.rb +++ b/spec/graphql/resolvers/project_resolver_spec.rb @@ -5,10 +5,9 @@ require 'spec_helper' describe Resolvers::ProjectResolver do include GraphqlHelpers - set(:project1) { create(:project) } - set(:project2) { create(:project) } - - set(:other_project) { create(:project) } + let_it_be(:project1) { create(:project) } + let_it_be(:project2) { create(:project) } + let_it_be(:other_project) { create(:project) } describe '#resolve' do it 'batch-resolves projects by full path' do |