diff options
author | Rémy Coutable <remy@rymai.me> | 2016-11-28 09:01:08 +0000 |
---|---|---|
committer | Alejandro Rodríguez <alejorro70@gmail.com> | 2016-12-01 12:38:34 -0300 |
commit | 8a6bc26600bba01fe6ffaf214a3bca6d464abb4d (patch) | |
tree | 44d9443ac0a17c03741558f41c081d8f441b1660 /spec | |
parent | ef3aec82b95aff84c033d022cfb9c7020a5b694d (diff) | |
download | gitlab-ce-8a6bc26600bba01fe6ffaf214a3bca6d464abb4d.tar.gz |
Merge branch 'fix-dead-help-link' into 'master'
Fix a broken link and avoid potential creation of future broken links on the help page.
See merge request !7582
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/help_controller_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/help_pages_spec.rb | 24 |
2 files changed, 27 insertions, 11 deletions
diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb index 6fc6ea95e13..cffed987f6b 100644 --- a/spec/controllers/help_controller_spec.rb +++ b/spec/controllers/help_controller_spec.rb @@ -16,14 +16,6 @@ describe HelpController do end end - context 'when url prefixed with help/' do - it 'will be an absolute path' do - stub_readme("[API](help/api/README.md)") - get :index - expect(assigns[:help_index]).to eq '[API](/help/api/README.md)' - end - end - context 'when url prefixed with help' do it 'will be an absolute path' do stub_readme("[API](helpful_hints/README.md)") @@ -32,11 +24,11 @@ describe HelpController do end end - context 'when url prefixed with /help/' do + context 'when url is an external link' do it 'will not be changed' do - stub_readme("[API](/help/api/README.md)") + stub_readme("[external](https://some.external.link)") get :index - expect(assigns[:help_index]).to eq '[API](/help/api/README.md)' + expect(assigns[:help_index]).to eq '[external](https://some.external.link)' end end end diff --git a/spec/features/help_pages_spec.rb b/spec/features/help_pages_spec.rb index e2101b333e2..73d03837144 100644 --- a/spec/features/help_pages_spec.rb +++ b/spec/features/help_pages_spec.rb @@ -10,4 +10,28 @@ describe 'Help Pages', feature: true do expect(page).to have_content("ssh-keygen -t rsa -C \"#{@user.email}\"") end end + + describe 'Get the main help page' do + shared_examples_for 'help page' do + it 'prefixes links correctly' do + expect(page).to have_selector('div.documentation-index > ul a[href="/help/api/README.md"]') + end + end + + context 'without a trailing slash' do + before do + visit help_path + end + + it_behaves_like 'help page' + end + + context 'with a trailing slash' do + before do + visit help_path + '/' + end + + it_behaves_like 'help page' + end + end end |