diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-10-01 16:59:44 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-10-02 17:11:32 +0300 |
commit | b09e40624b9fc6a7b4a7b38f174bc66d996e3fd5 (patch) | |
tree | 5bbe4e8da4966bbdbc30e6ab7bcfa50caff1c29b /spec/views/help | |
parent | df73116f75d4a7545fb4a7684aa76624efede7d0 (diff) |
Show the commit-sha for pre-release versions
The pre-release tags are set at the beginning of a release, so it
would be impossible to figure out which version was running if we're
running nightlies.
In that case it's better to still link to the SHA. These versions
don't get deployed to .com.
Diffstat (limited to 'spec/views/help')
-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 c8c9c4e773d..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('8.0.2', href: 'https://gitlab.com/gitlab-org/gitlab-ce/tags/v8.0.2') + 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('') |