diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-07 12:09:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-07 12:09:06 +0300 |
commit | dc7cd84a3edeab2f799e3a99edf33bf2a381eee7 (patch) | |
tree | 44b902f672e6bdef2d8852d233b4046ce18320cf /spec/serializers/merge_request_poll_widget_entity_spec.rb | |
parent | e28ed4a6b2aece29230c5dd0e08a0fd458663627 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers/merge_request_poll_widget_entity_spec.rb')
-rw-r--r-- | spec/serializers/merge_request_poll_widget_entity_spec.rb | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/spec/serializers/merge_request_poll_widget_entity_spec.rb b/spec/serializers/merge_request_poll_widget_entity_spec.rb index 9618624f226..366211731cc 100644 --- a/spec/serializers/merge_request_poll_widget_entity_spec.rb +++ b/spec/serializers/merge_request_poll_widget_entity_spec.rb @@ -11,9 +11,10 @@ RSpec.describe MergeRequestPollWidgetEntity do let_it_be(:user) { create(:user) } let(:request) { double('request', current_user: user, project: project) } + let(:options) { {} } subject do - described_class.new(resource, request: request).as_json + described_class.new(resource, { request: request }.merge(options)).as_json end it 'has default_merge_commit_message_with_description' do @@ -278,4 +279,39 @@ RSpec.describe MergeRequestPollWidgetEntity do ]) end end + + describe '#mergeable' do + it 'shows whether a merge request is mergeable' do + expect(subject[:mergeable]).to eq(true) + end + + context 'when merge request is in checking state' do + before do + resource.mark_as_unchecked! + resource.mark_as_checking! + end + + it 'calculates mergeability and returns true' do + expect(subject[:mergeable]).to eq(true) + end + + context 'when async_mergeability_check is passed' do + let(:options) { { async_mergeability_check: true } } + + it 'returns false' do + expect(subject[:mergeable]).to eq(false) + end + + context 'when check_mergeability_async_in_widget is disabled' do + before do + stub_feature_flags(check_mergeability_async_in_widget: false) + end + + it 'calculates mergeability and returns true' do + expect(subject[:mergeable]).to eq(true) + end + end + end + end + end end |