summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2015-12-21 12:08:04 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-14 12:48:13 +0100
commit37b2c5dd5521f25a7195e82538a0ffc528c3ec6d (patch)
tree7840e1f25d139d2422f3f54fa06381ee483356f4 /spec/lib/gitlab
parentd382335dcd9285c9355ed04dc12c5314bca3c024 (diff)
downloadgitlab-ce-37b2c5dd5521f25a7195e82538a0ffc528c3ec6d.tar.gz
Add support for root path for `StringPath`
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/string_path_spec.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/lib/gitlab/string_path_spec.rb b/spec/lib/gitlab/string_path_spec.rb
index 7818e340726..7ee69c7d3cb 100644
--- a/spec/lib/gitlab/string_path_spec.rb
+++ b/spec/lib/gitlab/string_path_spec.rb
@@ -11,6 +11,7 @@ describe Gitlab::StringPath do
'path/second_dir',
'path/second_dir/dir_3/file_2',
'path/second_dir/dir_3/file_3',
+ 'another_directory/',
'another_file',
'/file/with/absolute_path']
end
@@ -30,6 +31,7 @@ describe Gitlab::StringPath do
it { is_expected.to_not be_relative }
it { is_expected.to be_file }
it { is_expected.to_not have_parent }
+ it { is_expected.to_not have_descendants }
describe '#basename' do
subject { |example| path(example).basename }
@@ -43,7 +45,7 @@ describe Gitlab::StringPath do
it { is_expected.to be_directory }
it { is_expected.to be_relative }
- it { is_expected.to_not have_parent }
+ it { is_expected.to have_parent }
end
describe 'path/dir_1/', path: 'path/dir_1/' do
@@ -100,4 +102,24 @@ describe Gitlab::StringPath do
it { is_expected.to contain_exactly string_path('path/dir_1/subdir/') }
end
end
+
+ describe './', path: './' do
+ subject { |example| path(example) }
+
+ it { is_expected.to_not have_parent }
+ it { is_expected.to have_descendants }
+
+ describe '#descendants' do
+ subject { |example| path(example).descendants }
+
+ it { expect(subject.count).to eq universe.count - 1 }
+ it { is_expected.to_not include string_path('./') }
+ end
+
+ describe '#children' do
+ subject { |example| path(example).children }
+
+ it { expect(subject.count).to eq 3 }
+ end
+ end
end