diff options
Diffstat (limited to 'spec/views/help/index.html.haml_spec.rb')
-rw-r--r-- | spec/views/help/index.html.haml_spec.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/views/help/index.html.haml_spec.rb b/spec/views/help/index.html.haml_spec.rb index c59790a346e..600e431b7ef 100644 --- a/spec/views/help/index.html.haml_spec.rb +++ b/spec/views/help/index.html.haml_spec.rb @@ -21,6 +21,11 @@ RSpec.describe 'help/index' do end context 'when logged in' do + def version_link_regexp(path) + base_url = "#{view.source_host_url}/#{view.source_code_group}" + %r{#{Regexp.escape(base_url)}/(gitlab|gitlab\-foss)/#{Regexp.escape(path)}} + end + before do stub_user end @@ -31,7 +36,7 @@ RSpec.describe 'help/index' do render expect(rendered).to match '8.0.2' - expect(rendered).to have_link('8.0.2', href: %r{https://gitlab.com/gitlab-org/(gitlab|gitlab-foss)/-/tags/v8.0.2}) + expect(rendered).to have_link('8.0.2', href: version_link_regexp('-/tags/v8.0.2')) end it 'shows a link to the commit for pre-releases' do @@ -40,7 +45,7 @@ RSpec.describe 'help/index' do render expect(rendered).to match '8.0.2' - expect(rendered).to have_link('abcdefg', href: %r{https://gitlab.com/gitlab-org/(gitlab|gitlab-foss)/-/commits/abcdefg}) + expect(rendered).to have_link('abcdefg', href: version_link_regexp('-/commits/abcdefg')) end end end |