diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /spec/graphql/resolvers/project_pipeline_schedules_resolver_spec.rb | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'spec/graphql/resolvers/project_pipeline_schedules_resolver_spec.rb')
-rw-r--r-- | spec/graphql/resolvers/project_pipeline_schedules_resolver_spec.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/graphql/resolvers/project_pipeline_schedules_resolver_spec.rb b/spec/graphql/resolvers/project_pipeline_schedules_resolver_spec.rb new file mode 100644 index 00000000000..159335adf79 --- /dev/null +++ b/spec/graphql/resolvers/project_pipeline_schedules_resolver_spec.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Resolvers::ProjectPipelineSchedulesResolver do + include GraphqlHelpers + + let_it_be(:developer) { create(:user) } + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project, :repository, public_builds: false) } + + before do + project.add_owner(user) + end + + describe 'With filters' do + let(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: developer) } + + before do + pipeline_schedule.pipelines << build(:ci_pipeline, project: project) + end + + it 'shows active pipeline schedules' do + schedules = resolve_pipeline_schedules + + expect(schedules).to contain_exactly(pipeline_schedule) + end + + it 'shows the inactive pipeline schedules' do + schedules = resolve_pipeline_schedules(args: + { status: ::Types::Ci::PipelineScheduleStatusEnum.values['INACTIVE'].value }) + + expect(schedules).to be_empty + end + end + + def resolve_pipeline_schedules(args: {}) + resolve(described_class, obj: project, ctx: { current_user: user }, args: args) + end +end |