summaryrefslogtreecommitdiff
path: root/spec/lib/extracts_path_spec.rb
diff options
context:
space:
mode:
authorJun Futagawa <jfut@integ.jp>2013-01-23 17:29:46 +0900
committerJun Futagawa <jfut@integ.jp>2013-01-23 17:29:46 +0900
commit79b9249ff44c5ccbef44a8d9420a3fff369d932a (patch)
tree89677570a89f846d2291c57fb1abc5b7b5b6206c /spec/lib/extracts_path_spec.rb
parent65737bd5bd6eb65556699a176e69757a3ac8c37a (diff)
downloadgitlab-ce-79b9249ff44c5ccbef44a8d9420a3fff369d932a.tar.gz
Remove relative_url_root from path. Fixes #2602
Files and Commits render a 404 when running with relative_url_root.
Diffstat (limited to 'spec/lib/extracts_path_spec.rb')
-rw-r--r--spec/lib/extracts_path_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/extracts_path_spec.rb b/spec/lib/extracts_path_spec.rb
index deb6499e008..ee20ae79809 100644
--- a/spec/lib/extracts_path_spec.rb
+++ b/spec/lib/extracts_path_spec.rb
@@ -73,5 +73,28 @@ describe ExtractsPath do
extract_ref('/gitlab/gitlab-ci/tree/v2.0.0/CHANGELOG?_=12354435').should == ['v2.0.0', 'CHANGELOG']
end
end
+
+ context "with a fullpath and a relative_url_root" do
+ before do
+ Gitlab.config.gitlab.stub(relative_url_root: '/relative')
+ end
+
+ it "extracts a valid branch with relative_url_root" do
+ extract_ref('/relative/gitlab/gitlab-ci/tree/foo/bar/baz/CHANGELOG').should == ['foo/bar/baz', 'CHANGELOG']
+ end
+
+ it "extracts a valid tag" do
+ extract_ref('/relative/gitlab/gitlab-ci/tree/v2.0.0/CHANGELOG').should == ['v2.0.0', 'CHANGELOG']
+ end
+
+ it "extracts a valid commit SHA" do
+ extract_ref('/relative/gitlab/gitlab-ci/tree/f4b14494ef6abf3d144c28e4af0c20143383e062/CHANGELOG').should ==
+ ['f4b14494ef6abf3d144c28e4af0c20143383e062', 'CHANGELOG']
+ end
+
+ it "extracts a timestamp" do
+ extract_ref('/relative/gitlab/gitlab-ci/tree/v2.0.0/CHANGELOG?_=12354435').should == ['v2.0.0', 'CHANGELOG']
+ end
+ end
end
end