Commit f1143c83 authored by Jose Vargas's avatar Jose Vargas

Add test scenario for the jobs_resolver_spec

parent 29291f79
......@@ -71,7 +71,7 @@ module Types
end
def tags
object.tags.map { |tag| tag.name } if object.is_a?(::Ci::Build)
object.tags.map(&:name) if object.is_a?(::Ci::Build)
end
def detailed_status
......
......@@ -13,6 +13,7 @@ RSpec.describe Resolvers::Ci::JobsResolver do
create(:ci_build, :sast, name: 'DAST job', pipeline: pipeline)
create(:ci_build, :dast, name: 'SAST job', pipeline: pipeline)
create(:ci_build, :container_scanning, name: 'Container scanning job', pipeline: pipeline)
create(:ci_build, name: 'Job with tags', pipeline: pipeline, tag_list: ['review'])
end
describe '#resolve' do
......@@ -24,7 +25,8 @@ RSpec.describe Resolvers::Ci::JobsResolver do
have_attributes(name: 'Normal job'),
have_attributes(name: 'DAST job'),
have_attributes(name: 'SAST job'),
have_attributes(name: 'Container scanning job')
have_attributes(name: 'Container scanning job'),
have_attributes(name: 'Job with tags')
)
end
end
......@@ -43,5 +45,18 @@ RSpec.describe Resolvers::Ci::JobsResolver do
)
end
end
context 'when a job has tags' do
it "returns jobs with tags when applicable" do
jobs = resolve(described_class, obj: pipeline)
expect(jobs).to contain_exactly(
have_attributes(tag_list: []),
have_attributes(tag_list: []),
have_attributes(tag_list: []),
have_attributes(tag_list: []),
have_attributes(tag_list: ['review'])
)
end
end
end
end
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