Skip to content
Snippets Groups Projects
Commit 45824aab authored by Robert Speicher's avatar Robert Speicher
Browse files

Allow non-admin users to see version information

We want users to know what features they have available (and to pressure
their admins to upgrade).
parent be142e6b
No related branches found
No related tags found
No related merge requests found
Loading
@@ -2,7 +2,7 @@
Loading
@@ -2,7 +2,7 @@
%h1 %h1
GitLab GitLab
Community Edition Community Edition
- if current_user && current_user.admin? - if user_signed_in?
%span= Gitlab::VERSION %span= Gitlab::VERSION
%small= Gitlab::REVISION %small= Gitlab::REVISION
= version_status_badge = version_status_badge
Loading
Loading
Loading
@@ -3,18 +3,7 @@ require 'rails_helper'
Loading
@@ -3,18 +3,7 @@ require 'rails_helper'
describe 'help/index' do describe 'help/index' do
describe 'version information' do describe 'version information' do
it 'is hidden from guests' do it 'is hidden from guests' do
stub_user stub_user(nil)
stub_version('8.0.2', 'abcdefg')
stub_helpers
render
expect(rendered).not_to match '8.0.2'
expect(rendered).not_to match 'abcdefg'
end
it 'is hidden from users' do
stub_user(admin?: false)
stub_version('8.0.2', 'abcdefg') stub_version('8.0.2', 'abcdefg')
stub_helpers stub_helpers
   
Loading
@@ -24,8 +13,8 @@ describe 'help/index' do
Loading
@@ -24,8 +13,8 @@ describe 'help/index' do
expect(rendered).not_to match 'abcdefg' expect(rendered).not_to match 'abcdefg'
end end
   
it 'is shown to admins' do it 'is shown to users' do
stub_user(admin?: true) stub_user
stub_version('8.0.2', 'abcdefg') stub_version('8.0.2', 'abcdefg')
stub_helpers stub_helpers
   
Loading
@@ -36,10 +25,8 @@ describe 'help/index' do
Loading
@@ -36,10 +25,8 @@ describe 'help/index' do
end end
end end
   
def stub_user(messages = {}) def stub_user(user = double)
user = messages.empty? ? nil : double(messages) allow(view).to receive(:user_signed_in?).and_return(user)
allow(view).to receive(:current_user).and_return(user)
end end
   
def stub_version(version, revision) def stub_version(version, revision)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment