diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-27 21:09:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-27 21:09:41 +0300 |
commit | f569792df8a25caa1bed9c448c8c4c3f837f5164 (patch) | |
tree | 8c2ed7dae5ba132a97c0321a7649174e5832d637 /spec/helpers | |
parent | c2908ec6a0d7b62996cdb8da0350705bdad691bf (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/explore_helper_spec.rb | 19 | ||||
-rw-r--r-- | spec/helpers/projects/alert_management_helper_spec.rb | 17 |
2 files changed, 17 insertions, 19 deletions
diff --git a/spec/helpers/explore_helper_spec.rb b/spec/helpers/explore_helper_spec.rb index f8240dd3a4c..1a6af3be055 100644 --- a/spec/helpers/explore_helper_spec.rb +++ b/spec/helpers/explore_helper_spec.rb @@ -19,23 +19,10 @@ describe ExploreHelper do end describe '#public_visibility_restricted?' do - using RSpec::Parameterized::TableSyntax + it 'delegates to Gitlab::VisibilityLevel' do + expect(Gitlab::VisibilityLevel).to receive(:public_visibility_restricted?).and_call_original - where(:visibility_levels, :expected_status) do - nil | nil - [Gitlab::VisibilityLevel::PRIVATE] | false - [Gitlab::VisibilityLevel::PRIVATE, Gitlab::VisibilityLevel::INTERNAL] | false - [Gitlab::VisibilityLevel::PUBLIC] | true - end - - with_them do - before do - stub_application_setting(restricted_visibility_levels: visibility_levels) - end - - it 'returns the expected status' do - expect(helper.public_visibility_restricted?).to eq(expected_status) - end + helper.public_visibility_restricted? end end end diff --git a/spec/helpers/projects/alert_management_helper_spec.rb b/spec/helpers/projects/alert_management_helper_spec.rb index ee180cef692..9246d1deff6 100644 --- a/spec/helpers/projects/alert_management_helper_spec.rb +++ b/spec/helpers/projects/alert_management_helper_spec.rb @@ -5,21 +5,32 @@ require 'spec_helper' describe Projects::AlertManagementHelper do include Gitlab::Routing.url_helpers - let(:project) { create(:project) } + let_it_be(:project, reload: true) { create(:project) } + let_it_be(:current_user) { create(:user) } describe '#alert_management_data' do + let(:user_can_enable_alert_management) { false } let(:setting_path) { project_settings_operations_path(project) } let(:index_path) do project_alert_management_index_path(project, format: :json) end + before do + allow(helper) + .to receive(:can?) + .with(current_user, :admin_operations, project) + .and_return(user_can_enable_alert_management) + end + context 'without alert_managements_setting' do it 'returns frontend configuration' do - expect(alert_management_data(project)).to eq( + expect(alert_management_data(current_user, project)).to eq( 'index-path' => index_path, 'enable-alert-management-path' => setting_path, - "empty-alert-svg-path" => "/images/illustrations/alert-management-empty-state.svg" + "empty-alert-svg-path" => "/images/illustrations/alert-management-empty-state.svg", + 'user-can-enable-alert-management' => 'false', + 'alert-management-enabled' => 'true' ) end end |