debian-mirror-gitlab/spec/graphql/resolvers/project_pipeline_schedules_resolver_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.1 KiB
Ruby
Raw Normal View History

2022-11-25 23:54:43 +05:30
# 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