summaryrefslogtreecommitdiff
path: root/spec/graphql/mutations/concerns/mutations/resolves_project_spec.rb
blob: 19f5a8907a2006ddfbf9eb4c0992b30645c21114 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'spec_helper'

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

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

  it 'uses the ProjectsResolver to resolve projects by path' do
    project = create(:project)

    expect(Resolvers::ProjectResolver).to receive(:new).with(object: nil, context: context).and_call_original
    expect(mutation.resolve_project(full_path: project.full_path)).to eq(project)
  end
end