Fix routing issues when navigating over tree, commits etc

This commit is contained in:
Dmitriy Zaporozhets 2012-12-25 06:14:05 +03:00
parent 49e73f8ac1
commit c8ba5c2d58
7 changed files with 44 additions and 5 deletions

View file

@ -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