diff options
Diffstat (limited to 'spec/graphql/mutations/todos')
4 files changed, 10 insertions, 5 deletions
diff --git a/spec/graphql/mutations/todos/mark_all_done_spec.rb b/spec/graphql/mutations/todos/mark_all_done_spec.rb index 4af00307969..2f167164050 100644 --- a/spec/graphql/mutations/todos/mark_all_done_spec.rb +++ b/spec/graphql/mutations/todos/mark_all_done_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Mutations::Todos::MarkAllDone do +RSpec.describe Mutations::Todos::MarkAllDone do include GraphqlHelpers let_it_be(:current_user) { create(:user) } @@ -21,7 +21,7 @@ describe Mutations::Todos::MarkAllDone do describe '#resolve' do it 'marks all pending todos as done' do - updated_todo_ids = mutation_for(current_user).resolve.dig(:updated_ids) + updated_todo_ids, todos = mutation_for(current_user).resolve.values_at(:updated_ids, :todos) expect(todo1.reload.state).to eq('done') expect(todo2.reload.state).to eq('done') @@ -29,6 +29,7 @@ describe Mutations::Todos::MarkAllDone do expect(other_user_todo.reload.state).to eq('pending') expect(updated_todo_ids).to contain_exactly(global_id_of(todo1), global_id_of(todo3)) + expect(todos).to contain_exactly(todo1, todo3) end it 'behaves as expected if there are no todos for the requesting user' do diff --git a/spec/graphql/mutations/todos/mark_done_spec.rb b/spec/graphql/mutations/todos/mark_done_spec.rb index 44065f83f74..51ad3e1a5d7 100644 --- a/spec/graphql/mutations/todos/mark_done_spec.rb +++ b/spec/graphql/mutations/todos/mark_done_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Mutations::Todos::MarkDone do +RSpec.describe Mutations::Todos::MarkDone do include GraphqlHelpers let_it_be(:current_user) { create(:user) } diff --git a/spec/graphql/mutations/todos/restore_many_spec.rb b/spec/graphql/mutations/todos/restore_many_spec.rb index 8f4a8985f9e..b3b3e057745 100644 --- a/spec/graphql/mutations/todos/restore_many_spec.rb +++ b/spec/graphql/mutations/todos/restore_many_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Mutations::Todos::RestoreMany do +RSpec.describe Mutations::Todos::RestoreMany do let_it_be(:current_user) { create(:user) } let_it_be(:author) { create(:user) } let_it_be(:other_user) { create(:user) } @@ -25,6 +25,8 @@ describe Mutations::Todos::RestoreMany do todo_ids = result[:updated_ids] expect(todo_ids.size).to eq(1) expect(todo_ids.first).to eq(todo1.to_global_id.to_s) + + expect(result[:todos]).to contain_exactly(todo1) end it 'handles a todo which is already pending as expected' do @@ -33,6 +35,7 @@ describe Mutations::Todos::RestoreMany do expect_states_were_not_changed expect(result[:updated_ids]).to eq([]) + expect(result[:todos]).to be_empty end it 'ignores requests for todos which do not belong to the current user' do @@ -56,6 +59,7 @@ describe Mutations::Todos::RestoreMany do returned_todo_ids = result[:updated_ids] expect(returned_todo_ids).to contain_exactly(todo1.to_global_id.to_s, todo4.to_global_id.to_s) + expect(result[:todos]).to contain_exactly(todo1, todo4) expect(todo1.reload.state).to eq('pending') expect(todo2.reload.state).to eq('pending') diff --git a/spec/graphql/mutations/todos/restore_spec.rb b/spec/graphql/mutations/todos/restore_spec.rb index 949ab6a164b..9043d7a44a8 100644 --- a/spec/graphql/mutations/todos/restore_spec.rb +++ b/spec/graphql/mutations/todos/restore_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Mutations::Todos::Restore do +RSpec.describe Mutations::Todos::Restore do let_it_be(:current_user) { create(:user) } let_it_be(:author) { create(:user) } let_it_be(:other_user) { create(:user) } |