diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2015-12-22 11:05:22 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-14 12:48:13 +0100 |
commit | b19e958d86f5363057f006c8dbf9a8e8762618b9 (patch) | |
tree | 2f0239396ee98841374c99f73439c81a0939dad9 /spec/lib | |
parent | aae674c3a2bbe3e3c2303be0174fda785abb11d4 (diff) | |
download | gitlab-ce-b19e958d86f5363057f006c8dbf9a8e8762618b9.tar.gz |
Add support for parent directories in `StringPath`
This support is not completed though, as parent directory that is first
in collection returned by `directories!` is not iterable yet.
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/string_path_spec.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/lib/gitlab/string_path_spec.rb b/spec/lib/gitlab/string_path_spec.rb index 7ee69c7d3cb..c1722977576 100644 --- a/spec/lib/gitlab/string_path_spec.rb +++ b/spec/lib/gitlab/string_path_spec.rb @@ -50,18 +50,20 @@ describe Gitlab::StringPath do describe 'path/dir_1/', path: 'path/dir_1/' do subject { |example| path(example) } - it { is_expected.to have_parent } describe '#basename' do subject { |example| path(example).basename } - it { is_expected.to eq 'dir_1/' } end + describe '#name' do + subject { |example| path(example).name } + it { is_expected.to eq 'dir_1' } + end + describe '#parent' do subject { |example| path(example).parent } - it { is_expected.to eq string_path('path/') } end @@ -101,6 +103,15 @@ describe Gitlab::StringPath do it { is_expected.to all(be_an_instance_of described_class) } it { is_expected.to contain_exactly string_path('path/dir_1/subdir/') } end + + describe '#directories!' do + subject { |example| path(example).directories! } + + it { is_expected.to all(be_directory) } + it { is_expected.to all(be_an_instance_of described_class) } + it { is_expected.to contain_exactly string_path('path/dir_1/subdir/'), + string_path('path/dir_1/../') } + end end describe './', path: './' do @@ -118,7 +129,6 @@ describe Gitlab::StringPath do describe '#children' do subject { |example| path(example).children } - it { expect(subject.count).to eq 3 } end end |