summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-04-23 07:42:28 -0700
committerStan Hu <stanhu@gmail.com>2015-04-23 07:42:28 -0700
commit9a2e3d3d8196afefe32b099162b17f7441de8fb1 (patch)
treed37a97156c13d15eb85dbffce6a7a2c3de778767 /spec/helpers
parente3682122269d3c1a291de3c8d76d45f989a0ef97 (diff)
downloadgitlab-ce-9a2e3d3d8196afefe32b099162b17f7441de8fb1.tar.gz
Fix broken file browsing with relative submodule in personal projects
Closes https://github.com/gitlabhq/gitlabhq/issues/7554
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/submodule_helper_spec.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/helpers/submodule_helper_spec.rb b/spec/helpers/submodule_helper_spec.rb
index e99c3f5bc11..e98b75afabc 100644
--- a/spec/helpers/submodule_helper_spec.rb
+++ b/spec/helpers/submodule_helper_spec.rb
@@ -117,34 +117,41 @@ describe SubmoduleHelper do
context 'submodules with relative links' do
let(:group) { create(:group) }
let(:project) { create(:project, group: group) }
+ let(:commit_id) { sample_commit[:id] }
before do
self.instance_variable_set(:@project, project)
end
it 'one level down' do
- commit_id = sample_commit[:id]
result = relative_self_links('../test.git', commit_id)
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
end
it 'two levels down' do
- commit_id = sample_commit[:id]
result = relative_self_links('../../test.git', commit_id)
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
end
it 'one level down with namespace and repo' do
- commit_id = sample_commit[:id]
result = relative_self_links('../foobar/test.git', commit_id)
expect(result).to eq(["/foobar/test", "/foobar/test/tree/#{commit_id}"])
end
it 'two levels down with namespace and repo' do
- commit_id = sample_commit[:id]
result = relative_self_links('../foobar/baz/test.git', commit_id)
expect(result).to eq(["/baz/test", "/baz/test/tree/#{commit_id}"])
end
+
+ context 'personal project' do
+ let(:user) { create(:user) }
+ let(:project) { create(:project, namespace: user.namespace) }
+
+ it 'one level down with personal project' do
+ result = relative_self_links('../test.git', commit_id)
+ expect(result).to eq(["/#{user.username}/test", "/#{user.username}/test/tree/#{commit_id}"])
+ end
+ end
end
end