Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2017-03-24 18:54:22 +0300
committerJacob Vosmaer <jacob@gitlab.com>2017-03-29 15:48:04 +0300
commitc837da34391094b9d58763a67db5cfb706ca146f (patch)
treef8e37a66ab012b2a6ec0c40c18b7eb366b6b5c09 /spec/lib/gitlab/repo_path_spec.rb
parentb46ac16cc89d649bf5fba9a36f1911a575b41e1f (diff)
Helper method for storage path stripping
Diffstat (limited to 'spec/lib/gitlab/repo_path_spec.rb')
-rw-r--r--spec/lib/gitlab/repo_path_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/repo_path_spec.rb b/spec/lib/gitlab/repo_path_spec.rb
new file mode 100644
index 00000000000..0fb5d7646f2
--- /dev/null
+++ b/spec/lib/gitlab/repo_path_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+describe ::Gitlab::RepoPath do
+ describe '.strip_storage_path' do
+ before do
+ allow(Gitlab.config.repositories).to receive(:storages).and_return({
+ 'storage1' => { 'path' => '/foo' },
+ 'storage2' => { 'path' => '/bar' },
+ })
+ end
+
+ it 'strips the storage path' do
+ expect(described_class.strip_storage_path('/bar/foo/qux/baz.git')).to eq('foo/qux/baz.git')
+ end
+
+ it 'raises NotFoundError if no storage matches the path' do
+ expect { described_class.strip_storage_path('/doesnotexist/foo.git') }.to raise_error(
+ described_class::NotFoundError
+ )
+ end
+ end
+end