summaryrefslogtreecommitdiff
path: root/spec/graphql/mutations/concerns/mutations/resolves_group_spec.rb
blob: 6bed3a752ed89dacc257bd70a8b5f6b07e664bfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Mutations::ResolvesGroup do
  let(:mutation_class) do
    Class.new(Mutations::BaseMutation) do
      include Mutations::ResolvesGroup
    end
  end

  let(:context) { double }

  subject(:mutation) { mutation_class.new(object: nil, context: context, field: nil) }

  it 'uses the GroupsResolver to resolve groups by path' do
    group = create(:group)

    expect(Resolvers::GroupResolver).to receive(:new).with(object: nil, context: context, field: nil).and_call_original
    expect(mutation.resolve_group(full_path: group.full_path).sync).to eq(group)
  end
end