diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-08-01 18:17:47 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-08-01 18:17:47 +0300 |
commit | ea6fc714bb0306ac8ca56b5dafe4b6777aafe5fc (patch) | |
tree | 5d9673f0e526acbdb3285147024064f89d45dc23 /spec/support | |
parent | 47244ad5ea4e887ecb6dffa9f7b96846adbf4b6f (diff) | |
parent | 29dd1c14db6899c3858ca906e076c7b7fbbaa0e2 (diff) |
Merge branch '41416-making-instance-wide-data-tools-more-accessible' into 'master'
Resolve "Making instance-wide data tools more accessible"
Closes #41416 and #48507
See merge request gitlab-org/gitlab-ce!20874
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/instance_statistics_controllers_shared_examples.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/support/shared_examples/instance_statistics_controllers_shared_examples.rb b/spec/support/shared_examples/instance_statistics_controllers_shared_examples.rb new file mode 100644 index 00000000000..5334af841e1 --- /dev/null +++ b/spec/support/shared_examples/instance_statistics_controllers_shared_examples.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +shared_examples 'instance statistics availability' do + let(:user) { create(:user) } + + before do + sign_in(user) + end + + describe 'GET #index' do + it 'is available when the feature is available publicly' do + get :index + + expect(response).to have_gitlab_http_status(:success) + end + + it 'renders a 404 when the feature is not available publicly' do + stub_application_setting(instance_statistics_visibility_private: true) + + get :index + + expect(response).to have_gitlab_http_status(:not_found) + end + + context 'for admins' do + let(:user) { create(:admin) } + + it 'allows access when the feature is not available publicly' do + stub_application_setting(instance_statistics_visibility_private: true) + + get :index + + expect(response).to have_gitlab_http_status(:success) + end + end + end +end |