blob: bec25640c7fb14e7f3d753da061f4a8eb5680977 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Resolvers::Ci::TemplateResolver do
include GraphqlHelpers
describe '#resolve' do
let(:user) { create(:user) }
let(:project) { create(:project) }
subject(:resolve_subject) { resolve(described_class, obj: project, ctx: { current_user: user }, args: { name: template_name }) }
context 'when template exists' do
let(:template_name) { 'Android' }
it 'returns the found template' do
found_template = resolve_subject
expect(found_template).to be_an_instance_of(Gitlab::Template::GitlabCiYmlTemplate)
expect(found_template.name).to eq('Android')
end
end
context 'when template does not exist' do
let(:template_name) { 'invalidname' }
it 'returns nil' do
expect(resolve_subject).to eq(nil)
end
end
end
end
|