summaryrefslogtreecommitdiff
path: root/spec/graphql/resolvers/project_jobs_resolver_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/graphql/resolvers/project_jobs_resolver_spec.rb')
-rw-r--r--spec/graphql/resolvers/project_jobs_resolver_spec.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/spec/graphql/resolvers/project_jobs_resolver_spec.rb b/spec/graphql/resolvers/project_jobs_resolver_spec.rb
index 94df2999163..bb711a4c857 100644
--- a/spec/graphql/resolvers/project_jobs_resolver_spec.rb
+++ b/spec/graphql/resolvers/project_jobs_resolver_spec.rb
@@ -9,9 +9,10 @@ RSpec.describe Resolvers::ProjectJobsResolver do
let_it_be(:irrelevant_project) { create(:project, :repository) }
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
let_it_be(:irrelevant_pipeline) { create(:ci_pipeline, project: irrelevant_project) }
- let_it_be(:build_one) { create(:ci_build, :success, name: 'Build One', pipeline: pipeline) }
- let_it_be(:build_two) { create(:ci_build, :success, name: 'Build Two', pipeline: pipeline) }
- let_it_be(:build_three) { create(:ci_build, :failed, name: 'Build Three', pipeline: pipeline) }
+ let_it_be(:successful_build) { create(:ci_build, :success, name: 'Build One', pipeline: pipeline) }
+ let_it_be(:successful_build_two) { create(:ci_build, :success, name: 'Build Two', pipeline: pipeline) }
+ let_it_be(:failed_build) { create(:ci_build, :failed, name: 'Build Three', pipeline: pipeline) }
+ let_it_be(:pending_build) { create(:ci_build, :pending, name: 'Build Three', pipeline: pipeline) }
let(:irrelevant_build) { create(:ci_build, name: 'Irrelevant Build', pipeline: irrelevant_pipeline)}
let(:args) { {} }
@@ -28,11 +29,17 @@ RSpec.describe Resolvers::ProjectJobsResolver do
context 'with statuses argument' do
let(:args) { { statuses: [Types::Ci::JobStatusEnum.coerce_isolated_input('SUCCESS')] } }
- it { is_expected.to contain_exactly(build_one, build_two) }
+ it { is_expected.to contain_exactly(successful_build, successful_build_two) }
+ end
+
+ context 'with multiple statuses' do
+ let(:args) { { statuses: [Types::Ci::JobStatusEnum.coerce_isolated_input('SUCCESS'), Types::Ci::JobStatusEnum.coerce_isolated_input('FAILED')] } }
+
+ it { is_expected.to contain_exactly(successful_build, successful_build_two, failed_build) }
end
context 'without statuses argument' do
- it { is_expected.to contain_exactly(build_one, build_two, build_three) }
+ it { is_expected.to contain_exactly(successful_build, successful_build_two, failed_build, pending_build) }
end
end