2020-12-23 13:10:19 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe Resolvers::ReleaseMilestonesResolver do
|
|
|
|
include GraphqlHelpers
|
|
|
|
|
|
|
|
let_it_be(:release) { create(:release, :with_milestones, milestones_count: 2) }
|
2021-02-09 07:09:48 -05:00
|
|
|
let_it_be(:current_user) { create(:user, developer_projects: [release.project]) }
|
2020-12-23 13:10:19 -05:00
|
|
|
|
|
|
|
let(:resolved) do
|
2021-02-09 07:09:48 -05:00
|
|
|
resolve(described_class, obj: release, ctx: { current_user: current_user })
|
2020-12-23 13:10:19 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe '#resolve' do
|
2021-01-20 04:10:52 -05:00
|
|
|
it "uses offset-pagination" do
|
|
|
|
expect(resolved).to be_a(::Gitlab::Graphql::Pagination::OffsetPaginatedRelation)
|
2020-12-23 13:10:19 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it "includes the release's milestones in the returned OffsetActiveRecordRelationConnection" do
|
2021-01-20 04:10:52 -05:00
|
|
|
expect(resolved.to_a).to eq(release.milestones.order_by_dates_and_title)
|
2020-12-23 13:10:19 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|