diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-07-25 17:36:08 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-07-27 15:54:28 +0200 |
commit | 00b5f5475f7f35620d01033711cdb8e2f5fff5c8 (patch) | |
tree | 128cc055ea7a8233ca23b0b78fd2a7dc646d063b /spec/support | |
parent | 702a09c18365cbaa88edb8396339a61a73f29d23 (diff) | |
download | gitlab-ce-00b5f5475f7f35620d01033711cdb8e2f5fff5c8.tar.gz |
Spec instance statistics
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 |