summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2015-12-18 11:59:10 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-14 12:48:12 +0100
commitf5d530865875440d69217cf249715bffaa3d11b8 (patch)
treec2b9d2da4ed5f6fe9b0bb51d89eafedd20de71dc /spec/lib
parentf091272f1982dfe977c9f366e4127fbbe0314f4a (diff)
downloadgitlab-ce-f5d530865875440d69217cf249715bffaa3d11b8.tar.gz
Add implementation of StringPath class
`StringPath` class is something similar to Ruby's `Pathname` class, but does not involve any IO operations. `StringPath` objects require passing string representation of path, and array of paths that represents universe to constructor to be intantiated.
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/string_path_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/gitlab/string_path_spec.rb b/spec/lib/gitlab/string_path_spec.rb
new file mode 100644
index 00000000000..14a08bcb49b
--- /dev/null
+++ b/spec/lib/gitlab/string_path_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe Gitlab::StringPath do
+ let(:universe) do
+ ['path/dir_1/',
+ 'path/dir_1/file_1',
+ 'path/second_dir',
+ 'path/second_dir/dir_3/file_2',
+ 'path/second_dir/dir_3/file_3',
+ 'another_file',
+ '/file/with/absolute_path']
+ end
+
+ describe '/file/with/absolute_path' do
+ subject { described_class.new('/file/with/absolute_path', universe) }
+
+ it { is_expected.to be_absolute }
+ it { is_expected.to_not be_relative }
+ it { is_expected.to be_file }
+ end
+end