summaryrefslogtreecommitdiff
path: root/spec/lib/extracts_path_spec.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-12-25 06:14:05 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-12-25 06:14:05 +0300
commitc8ba5c2d58b882fd7cd5342a42158bb5f810fd60 (patch)
treec1584cc5235be75b3c6ef1a3e2a46d5ff33a73c8 /spec/lib/extracts_path_spec.rb
parent49e73f8ac1f9b9dabc900a56e98a1cc83b40dc49 (diff)
downloadgitlab-ce-c8ba5c2d58b882fd7cd5342a42158bb5f810fd60.tar.gz
Fix routing issues when navigating over tree, commits etc
Diffstat (limited to 'spec/lib/extracts_path_spec.rb')
-rw-r--r--spec/lib/extracts_path_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/extracts_path_spec.rb b/spec/lib/extracts_path_spec.rb
index cf4220175a7..8773d77f5a5 100644
--- a/spec/lib/extracts_path_spec.rb
+++ b/spec/lib/extracts_path_spec.rb
@@ -8,6 +8,7 @@ describe ExtractsPath do
before do
@project = project
project.stub(:ref_names).and_return(['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0'])
+ project.stub(path_with_namespace: 'gitlab/gitlab-ci')
end
describe '#extract_ref' do
@@ -53,5 +54,24 @@ describe ExtractsPath do
extract_ref('stable/CHANGELOG').should == ['stable', 'CHANGELOG']
end
end
+
+ context "with a fullpath" do
+ it "extracts a valid branch" do
+ extract_ref('/gitlab/gitlab-ci/tree/foo/bar/baz/CHANGELOG').should == ['foo/bar/baz', 'CHANGELOG']
+ end
+
+ it "extracts a valid tag" do
+ extract_ref('/gitlab/gitlab-ci/tree/v2.0.0/CHANGELOG').should == ['v2.0.0', 'CHANGELOG']
+ end
+
+ it "extracts a valid commit SHA" do
+ extract_ref('/gitlab/gitlab-ci/tree/f4b14494ef6abf3d144c28e4af0c20143383e062/CHANGELOG').should ==
+ ['f4b14494ef6abf3d144c28e4af0c20143383e062', 'CHANGELOG']
+ end
+
+ it "extracts a timestamp" do
+ extract_ref('/gitlab/gitlab-ci/tree/v2.0.0/CHANGELOG?_=12354435').should == ['v2.0.0', 'CHANGELOG']
+ end
+ end
end
end