2021-03-08 18:12:59 +05:30
|
|
|
# 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-03-11 19:13:27 +05:30
|
|
|
let_it_be(:current_user) { create(:user, developer_projects: [release.project]) }
|
2021-03-08 18:12:59 +05:30
|
|
|
|
|
|
|
let(:resolved) do
|
2021-03-11 19:13:27 +05:30
|
|
|
resolve(described_class, obj: release, ctx: { current_user: current_user })
|
2021-03-08 18:12:59 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe '#resolve' do
|
2021-03-11 19:13:27 +05:30
|
|
|
it "uses offset-pagination" do
|
|
|
|
expect(resolved).to be_a(::Gitlab::Graphql::Pagination::OffsetPaginatedRelation)
|
2021-03-08 18:12:59 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it "includes the release's milestones in the returned OffsetActiveRecordRelationConnection" do
|
2021-03-11 19:13:27 +05:30
|
|
|
expect(resolved.to_a).to eq(release.milestones.order_by_dates_and_title)
|
2021-03-08 18:12:59 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|