debian-mirror-gitlab/spec/graphql/types/merge_request_type_spec.rb

43 lines
1.8 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe GitlabSchema.types['MergeRequest'] do
2020-05-24 23:13:21 +05:30
specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::MergeRequest) }
2018-11-08 19:23:39 +05:30
2020-05-24 23:13:21 +05:30
specify { expect(described_class).to require_graphql_authorizations(:read_merge_request) }
2018-11-08 19:23:39 +05:30
2020-05-24 23:13:21 +05:30
specify { expect(described_class.interfaces).to include(Types::Notes::NoteableType) }
2019-09-04 21:01:54 +05:30
2020-11-24 15:15:51 +05:30
specify { expect(described_class.interfaces).to include(Types::CurrentUserTodos) }
2019-09-30 21:07:59 +05:30
it 'has the expected fields' do
expected_fields = %w[
notes discussions user_permissions id iid title title_html description
description_html state created_at updated_at source_project target_project
project project_id source_project_id target_project_id source_branch
target_branch work_in_progress merge_when_pipeline_succeeds diff_head_sha
2020-07-28 23:09:34 +05:30
merge_commit_sha user_notes_count should_remove_source_branch
diff_refs diff_stats diff_stats_summary
2019-09-30 21:07:59 +05:30
force_remove_source_branch merge_status in_progress_merge_commit_sha
merge_error allow_collaboration should_be_rebased rebase_commit_sha
rebase_in_progress merge_commit_message default_merge_commit_message
2020-06-23 00:09:42 +05:30
merge_ongoing mergeable_discussions_state web_url
source_branch_exists target_branch_exists
2019-12-21 20:55:43 +05:30
upvotes downvotes head_pipeline pipelines task_completion_status
milestone assignees participants subscribed labels discussion_locked time_estimate
2020-11-24 15:15:51 +05:30
total_time_spent reference author merged_at commit_count current_user_todos
conflicts auto_merge_enabled
2019-09-30 21:07:59 +05:30
]
2020-11-24 15:15:51 +05:30
if Gitlab.ee?
expected_fields << 'approved'
expected_fields << 'approvals_left'
expected_fields << 'approvals_required'
expected_fields << 'approved_by'
end
2020-10-24 23:57:45 +05:30
2020-04-22 19:07:51 +05:30
expect(described_class).to have_graphql_fields(*expected_fields)
2018-11-08 19:23:39 +05:30
end
end