diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-04 15:11:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-04 15:11:58 +0300 |
commit | 0327ce54a7e315b3aa6f80cc4e540fbb6792f2e3 (patch) | |
tree | f27611f4cc36d1aa9215e5bd0ff4787e60e77bd0 /spec/serializers | |
parent | 266aad4e70f3c642583ab60894b27b2622095cd8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/merge_request_widget_entity_spec.rb | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/spec/serializers/merge_request_widget_entity_spec.rb b/spec/serializers/merge_request_widget_entity_spec.rb index 35846b0d4ea..fcfdbfc0967 100644 --- a/spec/serializers/merge_request_widget_entity_spec.rb +++ b/spec/serializers/merge_request_widget_entity_spec.rb @@ -283,28 +283,6 @@ RSpec.describe MergeRequestWidgetEntity do it 'provides a valid value for suggest pipeline feature id' do expect(subject[:suggest_pipeline_feature_id]).to eq described_class::SUGGEST_PIPELINE end - - it 'provides a valid value for if it is dismissed' do - expect(subject[:is_dismissed_suggest_pipeline]).to be(false) - end - - context 'when the suggest pipeline has been dismissed' do - before do - create(:user_callout, user: user, feature_name: described_class::SUGGEST_PIPELINE) - end - - it 'indicates suggest pipeline has been dismissed' do - expect(subject[:is_dismissed_suggest_pipeline]).to be(true) - end - end - - context 'when user is not logged in' do - let(:request) { double('request', current_user: nil, project: project) } - - it 'returns a blank is dismissed value' do - expect(subject[:is_dismissed_suggest_pipeline]).to be_nil - end - end end it 'has human access' do @@ -395,4 +373,46 @@ RSpec.describe MergeRequestWidgetEntity do end end end + + describe 'is_dismissed_suggest_pipeline' do + context 'when user is logged in' do + context 'when the suggest pipeline feature is enabled' do + before do + allow(Gitlab::CurrentSettings).to receive(:suggest_pipeline_enabled?).and_return(true) + end + + it 'is false' do + expect(subject[:is_dismissed_suggest_pipeline]).to be(false) + end + + context 'when suggest pipeline has been dismissed' do + before do + create(:user_callout, user: user, feature_name: described_class::SUGGEST_PIPELINE) + end + + it 'is true' do + expect(subject[:is_dismissed_suggest_pipeline]).to be(true) + end + end + end + + context 'when the suggest pipeline feature is disabled' do + before do + allow(Gitlab::CurrentSettings).to receive(:suggest_pipeline_enabled?).and_return(false) + end + + it 'is true' do + expect(subject[:is_dismissed_suggest_pipeline]).to be(true) + end + end + end + + context 'when user is not logged in' do + let(:request) { double('request', current_user: nil, project: project) } + + it 'is true' do + expect(subject[:is_dismissed_suggest_pipeline]).to be(true) + end + end + end end |