summaryrefslogtreecommitdiff
path: root/spec/controllers/help_controller_spec.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-12-01 12:07:52 +0100
committerRémy Coutable <remy@rymai.me>2016-12-01 16:40:48 +0100
commit633538151b99c658bcbb2173e91eb5deba4408f7 (patch)
treea1b160554e8fb94a40ef3176e86128b0cbdeef28 /spec/controllers/help_controller_spec.rb
parent507abdb7739c2c6df49cee77c966c4db0dcaf1bb (diff)
downloadgitlab-ce-633538151b99c658bcbb2173e91eb5deba4408f7.tar.gz
Fix URL rewritting in the Help section25199-fix-broken-urls-in-help-page
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/controllers/help_controller_spec.rb')
-rw-r--r--spec/controllers/help_controller_spec.rb24
1 files changed, 15 insertions, 9 deletions
diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb
index cffed987f6b..d3489324a9c 100644
--- a/spec/controllers/help_controller_spec.rb
+++ b/spec/controllers/help_controller_spec.rb
@@ -8,26 +8,32 @@ describe HelpController do
end
describe 'GET #index' do
- context 'when url prefixed without /help/' do
- it 'has correct url prefix' do
- stub_readme("[API](api/README.md)")
+ context 'with absolute url' do
+ it 'keeps the URL absolute' do
+ stub_readme("[API](/api/README.md)")
+
get :index
- expect(assigns[:help_index]).to eq '[API](/help/api/README.md)'
+
+ expect(assigns[:help_index]).to eq '[API](/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)")
+ context 'with relative url' do
+ it 'prefixes it with /help/' do
+ stub_readme("[API](api/README.md)")
+
get :index
- expect(assigns[:help_index]).to eq '[API](/help/helpful_hints/README.md)'
+
+ expect(assigns[:help_index]).to eq '[API](/help/api/README.md)'
end
end
context 'when url is an external link' do
- it 'will not be changed' do
+ it 'does not change it' do
stub_readme("[external](https://some.external.link)")
+
get :index
+
expect(assigns[:help_index]).to eq '[external](https://some.external.link)'
end
end