diff options
Diffstat (limited to 'spec/views/help/index.html.haml_spec.rb')
-rw-r--r-- | spec/views/help/index.html.haml_spec.rb | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/spec/views/help/index.html.haml_spec.rb b/spec/views/help/index.html.haml_spec.rb index 4b4de540d9e..34e93d929a7 100644 --- a/spec/views/help/index.html.haml_spec.rb +++ b/spec/views/help/index.html.haml_spec.rb @@ -1,11 +1,18 @@ +# frozen_string_literal: true + require 'rails_helper' describe 'help/index' do + include StubVersion + describe 'version information' do + before do + stub_helpers + end + it 'is hidden from guests' do stub_user(nil) stub_version('8.0.2', 'abcdefg') - stub_helpers render @@ -13,15 +20,28 @@ describe 'help/index' do expect(rendered).not_to match 'abcdefg' end - it 'is shown to users' do - stub_user - stub_version('8.0.2', 'abcdefg') - stub_helpers + context 'when logged in' do + before do + stub_user + end - render + it 'shows a link to the tag to users' do + stub_version('8.0.2', 'abcdefg') + + render + + expect(rendered).to match '8.0.2' + expect(rendered).to have_link('8.0.2', href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/tags/v8.0.2}) + end + + it 'shows a link to the commit for pre-releases' do + stub_version('8.0.2-pre', 'abcdefg') - expect(rendered).to match '8.0.2' - expect(rendered).to have_link('abcdefg', href: 'https://gitlab.com/gitlab-org/gitlab-ce/commits/abcdefg') + render + + expect(rendered).to match '8.0.2' + expect(rendered).to have_link('abcdefg', href: %r{https://gitlab.com/gitlab-org/gitlab-(ce|ee)/commits/abcdefg}) + end end end @@ -37,11 +57,6 @@ describe 'help/index' do allow(view).to receive(:user_signed_in?).and_return(user) end - def stub_version(version, revision) - stub_const('Gitlab::VERSION', version) - allow(Gitlab).to receive(:revision).and_return(revision) - end - def stub_helpers allow(view).to receive(:markdown).and_return('') allow(view).to receive(:version_status_badge).and_return('') |