Commit 3b718c76 authored by Sean Arnold's avatar Sean Arnold

Add specs to GraphQL mutations testing authorize

- All mutations with authorize added
parent 5786170f
......@@ -8,6 +8,8 @@ describe Mutations::Issues::SetConfidential do
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
specify { expect(described_class).to require_graphql_authorizations(:update_issue) }
describe '#resolve' do
let(:confidential) { true }
let(:mutated_issue) { subject[:issue] }
......
......@@ -8,6 +8,8 @@ describe Mutations::Issues::SetDueDate do
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
specify { expect(described_class).to require_graphql_authorizations(:update_issue) }
describe '#resolve' do
let(:due_date) { 2.days.since }
let(:mutated_issue) { subject[:issue] }
......
......@@ -8,6 +8,8 @@ describe Mutations::MergeRequests::SetLabels do
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
specify { expect(described_class).to require_graphql_authorizations(:update_merge_request) }
describe '#resolve' do
let(:label) { create(:label, project: merge_request.project) }
let(:label2) { create(:label, project: merge_request.project) }
......
......@@ -8,6 +8,8 @@ describe Mutations::MergeRequests::SetLocked do
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
specify { expect(described_class).to require_graphql_authorizations(:update_merge_request) }
describe '#resolve' do
let(:locked) { true }
let(:mutated_merge_request) { subject[:merge_request] }
......
......@@ -8,6 +8,8 @@ describe Mutations::MergeRequests::SetMilestone do
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
specify { expect(described_class).to require_graphql_authorizations(:update_merge_request) }
describe '#resolve' do
let(:milestone) { create(:milestone, project: merge_request.project) }
let(:mutated_merge_request) { subject[:merge_request] }
......
......@@ -9,6 +9,8 @@ describe Mutations::MergeRequests::SetSubscription do
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
specify { expect(described_class).to require_graphql_authorizations(:update_merge_request) }
describe '#resolve' do
let(:subscribe) { true }
let(:mutated_merge_request) { subject[:merge_request] }
......
......@@ -8,6 +8,8 @@ describe Mutations::MergeRequests::SetWip do
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
specify { expect(described_class).to require_graphql_authorizations(:update_merge_request) }
describe '#resolve' do
let(:wip) { true }
let(:mutated_merge_request) { subject[:merge_request] }
......
......@@ -17,6 +17,8 @@ describe Mutations::Todos::MarkAllDone do
let_it_be(:user3) { create(:user) }
specify { expect(described_class).to require_graphql_authorizations(:update_user) }
describe '#resolve' do
it 'marks all pending todos as done' do
updated_todo_ids = mutation_for(current_user).resolve.dig(:updated_ids)
......
......@@ -16,6 +16,8 @@ describe Mutations::Todos::MarkDone do
let(:mutation) { described_class.new(object: nil, context: { current_user: current_user }, field: nil) }
specify { expect(described_class).to require_graphql_authorizations(:update_todo) }
describe '#resolve' do
it 'marks a single todo as done' do
result = mark_done_mutation(todo1)
......
......@@ -14,6 +14,8 @@ describe Mutations::Todos::Restore do
let(:mutation) { described_class.new(object: nil, context: { current_user: current_user }, field: nil) }
specify { expect(described_class).to require_graphql_authorizations(:update_todo) }
describe '#resolve' do
it 'restores a single todo' do
result = restore_mutation(todo1)
......
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