diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 21:07:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 21:07:48 +0300 |
commit | e72386771751fb22245bc6604fef236a2ee130cb (patch) | |
tree | 7cf54bca933159cb177d3caa2f139f87d6d30391 /spec/graphql | |
parent | c2b98d3dbd47ab92c79c702276fe9130d9a28036 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql')
13 files changed, 21 insertions, 0 deletions
diff --git a/spec/graphql/mutations/concerns/mutations/resolves_group_spec.rb b/spec/graphql/mutations/concerns/mutations/resolves_group_spec.rb index 897b8f4e9ef..fcc717f83a2 100644 --- a/spec/graphql/mutations/concerns/mutations/resolves_group_spec.rb +++ b/spec/graphql/mutations/concerns/mutations/resolves_group_spec.rb @@ -10,6 +10,7 @@ describe Mutations::ResolvesGroup do end let(:context) { double } + subject(:mutation) { mutation_class.new(object: nil, context: context) } it 'uses the GroupsResolver to resolve groups by path' do diff --git a/spec/graphql/mutations/concerns/mutations/resolves_project_spec.rb b/spec/graphql/mutations/concerns/mutations/resolves_project_spec.rb index 09d1f66a2c7..918e5fb016e 100644 --- a/spec/graphql/mutations/concerns/mutations/resolves_project_spec.rb +++ b/spec/graphql/mutations/concerns/mutations/resolves_project_spec.rb @@ -10,6 +10,7 @@ describe Mutations::ResolvesProject do end let(:context) { double } + subject(:mutation) { mutation_class.new(object: nil, context: context) } it 'uses the ProjectsResolver to resolve projects by path' do diff --git a/spec/graphql/mutations/issues/set_confidential_spec.rb b/spec/graphql/mutations/issues/set_confidential_spec.rb index 05b787eb5ca..a8f1fcdf7f1 100644 --- a/spec/graphql/mutations/issues/set_confidential_spec.rb +++ b/spec/graphql/mutations/issues/set_confidential_spec.rb @@ -5,11 +5,13 @@ require 'spec_helper' describe Mutations::Issues::SetConfidential do let(:issue) { create(:issue) } let(:user) { create(:user) } + subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } describe '#resolve' do let(:confidential) { true } let(:mutated_issue) { subject[:issue] } + subject { mutation.resolve(project_path: issue.project.full_path, iid: issue.iid, confidential: confidential) } it 'raises an error if the resource is not accessible to the user' do diff --git a/spec/graphql/mutations/issues/set_due_date_spec.rb b/spec/graphql/mutations/issues/set_due_date_spec.rb index 9a1f0925fe3..b45a7b460cd 100644 --- a/spec/graphql/mutations/issues/set_due_date_spec.rb +++ b/spec/graphql/mutations/issues/set_due_date_spec.rb @@ -5,11 +5,13 @@ require 'spec_helper' describe Mutations::Issues::SetDueDate do let(:issue) { create(:issue) } let(:user) { create(:user) } + subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } describe '#resolve' do let(:due_date) { 2.days.since } let(:mutated_issue) { subject[:issue] } + subject { mutation.resolve(project_path: issue.project.full_path, iid: issue.iid, due_date: due_date) } it 'raises an error if the resource is not accessible to the user' do diff --git a/spec/graphql/mutations/merge_requests/set_assignees_spec.rb b/spec/graphql/mutations/merge_requests/set_assignees_spec.rb index e8da0e25b7d..2033ab57a0d 100644 --- a/spec/graphql/mutations/merge_requests/set_assignees_spec.rb +++ b/spec/graphql/mutations/merge_requests/set_assignees_spec.rb @@ -5,6 +5,7 @@ require 'spec_helper' describe Mutations::MergeRequests::SetAssignees do let(:merge_request) { create(:merge_request) } let(:user) { create(:user) } + subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } describe '#resolve' do @@ -12,6 +13,7 @@ describe Mutations::MergeRequests::SetAssignees do let(:assignee2) { create(:user) } let(:assignee_usernames) { [assignee.username] } let(:mutated_merge_request) { subject[:merge_request] } + subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, assignee_usernames: assignee_usernames) } before do diff --git a/spec/graphql/mutations/merge_requests/set_labels_spec.rb b/spec/graphql/mutations/merge_requests/set_labels_spec.rb index 3729251bab7..f7c04a57f68 100644 --- a/spec/graphql/mutations/merge_requests/set_labels_spec.rb +++ b/spec/graphql/mutations/merge_requests/set_labels_spec.rb @@ -5,6 +5,7 @@ require 'spec_helper' describe Mutations::MergeRequests::SetLabels do let(:merge_request) { create(:merge_request) } let(:user) { create(:user) } + subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } describe '#resolve' do @@ -12,6 +13,7 @@ describe Mutations::MergeRequests::SetLabels do let(:label2) { create(:label, project: merge_request.project) } let(:label_ids) { [label.to_global_id] } let(:mutated_merge_request) { subject[:merge_request] } + subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, label_ids: label_ids) } it 'raises an error if the resource is not accessible to the user' do diff --git a/spec/graphql/mutations/merge_requests/set_locked_spec.rb b/spec/graphql/mutations/merge_requests/set_locked_spec.rb index 51249854378..d35430abff1 100644 --- a/spec/graphql/mutations/merge_requests/set_locked_spec.rb +++ b/spec/graphql/mutations/merge_requests/set_locked_spec.rb @@ -5,11 +5,13 @@ require 'spec_helper' describe Mutations::MergeRequests::SetLocked do let(:merge_request) { create(:merge_request) } let(:user) { create(:user) } + subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } describe '#resolve' do let(:locked) { true } let(:mutated_merge_request) { subject[:merge_request] } + subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, locked: locked) } it 'raises an error if the resource is not accessible to the user' do diff --git a/spec/graphql/mutations/merge_requests/set_milestone_spec.rb b/spec/graphql/mutations/merge_requests/set_milestone_spec.rb index c2792a4bc25..d79b0a995d7 100644 --- a/spec/graphql/mutations/merge_requests/set_milestone_spec.rb +++ b/spec/graphql/mutations/merge_requests/set_milestone_spec.rb @@ -5,11 +5,13 @@ require 'spec_helper' describe Mutations::MergeRequests::SetMilestone do let(:merge_request) { create(:merge_request) } let(:user) { create(:user) } + subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } describe '#resolve' do let(:milestone) { create(:milestone, project: merge_request.project) } let(:mutated_merge_request) { subject[:merge_request] } + subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, milestone: milestone) } it 'raises an error if the resource is not accessible to the user' do diff --git a/spec/graphql/mutations/merge_requests/set_subscription_spec.rb b/spec/graphql/mutations/merge_requests/set_subscription_spec.rb index 116a77abcc0..286de6c0c97 100644 --- a/spec/graphql/mutations/merge_requests/set_subscription_spec.rb +++ b/spec/graphql/mutations/merge_requests/set_subscription_spec.rb @@ -6,11 +6,13 @@ describe Mutations::MergeRequests::SetSubscription do let(:merge_request) { create(:merge_request) } let(:project) { merge_request.project } let(:user) { create(:user) } + subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } describe '#resolve' do let(:subscribe) { true } let(:mutated_merge_request) { subject[:merge_request] } + subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, subscribed_state: subscribe) } it 'raises an error if the resource is not accessible to the user' do diff --git a/spec/graphql/mutations/merge_requests/set_wip_spec.rb b/spec/graphql/mutations/merge_requests/set_wip_spec.rb index c4accab9e46..490994c4577 100644 --- a/spec/graphql/mutations/merge_requests/set_wip_spec.rb +++ b/spec/graphql/mutations/merge_requests/set_wip_spec.rb @@ -5,11 +5,13 @@ require 'spec_helper' describe Mutations::MergeRequests::SetWip do let(:merge_request) { create(:merge_request) } let(:user) { create(:user) } + subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } describe '#resolve' do let(:wip) { true } let(:mutated_merge_request) { subject[:merge_request] } + subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, wip: wip) } it 'raises an error if the resource is not accessible to the user' do diff --git a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb index fa031af4013..b59561ebdd4 100644 --- a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb +++ b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb @@ -16,6 +16,7 @@ describe ResolvesPipelines do end 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) } diff --git a/spec/graphql/resolvers/error_tracking/sentry_detailed_error_resolver_spec.rb b/spec/graphql/resolvers/error_tracking/sentry_detailed_error_resolver_spec.rb index 5e7f18636ec..4490b54d1f7 100644 --- a/spec/graphql/resolvers/error_tracking/sentry_detailed_error_resolver_spec.rb +++ b/spec/graphql/resolvers/error_tracking/sentry_detailed_error_resolver_spec.rb @@ -20,6 +20,7 @@ describe Resolvers::ErrorTracking::SentryDetailedErrorResolver do describe '#resolve' do let(:args) { { id: issue_global_id(1234) } } + it 'fetches the data via the sentry API' do resolve_error(args) diff --git a/spec/graphql/types/permission_types/base_permission_type_spec.rb b/spec/graphql/types/permission_types/base_permission_type_spec.rb index a45102e5b50..aa6b4320006 100644 --- a/spec/graphql/types/permission_types/base_permission_type_spec.rb +++ b/spec/graphql/types/permission_types/base_permission_type_spec.rb @@ -6,6 +6,7 @@ describe Types::PermissionTypes::BasePermissionType do let(:permitable) { double('permittable') } let(:current_user) { build(:user) } let(:context) { { current_user: current_user } } + subject(:test_type) do Class.new(described_class) do graphql_name 'TestClass' |