diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-04 12:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-04 12:09:45 +0300 |
commit | 1db4510841a44a95447ddbb6eed22c5505332322 (patch) | |
tree | 6f4a96b14242431c46b9441525df337ad0ec8a0d /spec/serializers/merge_request_widget_entity_spec.rb | |
parent | 10fb317361b93a1a54b17444dec80f5758151a85 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers/merge_request_widget_entity_spec.rb')
-rw-r--r-- | spec/serializers/merge_request_widget_entity_spec.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/serializers/merge_request_widget_entity_spec.rb b/spec/serializers/merge_request_widget_entity_spec.rb index 795e73789d1..1704208d8b9 100644 --- a/spec/serializers/merge_request_widget_entity_spec.rb +++ b/spec/serializers/merge_request_widget_entity_spec.rb @@ -256,6 +256,62 @@ RSpec.describe MergeRequestWidgetEntity do end end + describe 'user callouts' do + context 'when suggest pipeline feature is enabled' do + before do + stub_feature_flags(suggest_pipeline: true) + end + + it 'provides a valid path value for user callout path' do + expect(subject[:user_callouts_path]).to eq '/-/user_callouts' + end + + 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 + + context 'when suggest pipeline feature is not enabled' do + before do + stub_feature_flags(suggest_pipeline: false) + end + + it 'provides no valid value for user callout path' do + expect(subject[:user_callouts_path]).to be_nil + end + + it 'provides no valid value for suggest pipeline feature id' do + expect(subject[:suggest_pipeline_feature_id]).to be_nil + end + + it 'provides no valid value for if it is dismissed' do + expect(subject[:is_dismissed_suggest_pipeline]).to be_nil + end + end + end + it 'has human access' do project.add_maintainer(user) |