summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorcuriositycasualty <isa@getchef.com>2014-10-14 12:24:54 -0700
committercuriositycasualty <isa@getchef.com>2014-10-28 11:56:43 -0700
commitb09abbab21f835c39cf82996fbc4bd49c0192932 (patch)
treeaade619c207f6a703b97a658a71fdb3e401b28c4 /spec/unit
parent8c06a8c16f4e1dd124415514082359e3dcef6f89 (diff)
downloadchef-b09abbab21f835c39cf82996fbc4bd49c0192932.tar.gz
add empty? method for cheffs base dir class
add spec tests remove commented pry binding delegate to Array#empty? instead
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/chef_fs/file_system_spec.rb23
1 files changed, 18 insertions, 5 deletions
diff --git a/spec/unit/chef_fs/file_system_spec.rb b/spec/unit/chef_fs/file_system_spec.rb
index 383a2c81ab..50f20a7a1c 100644
--- a/spec/unit/chef_fs/file_system_spec.rb
+++ b/spec/unit/chef_fs/file_system_spec.rb
@@ -66,18 +66,19 @@ describe Chef::ChefFS::FileSystem do
:c => '',
}
},
- :x => ''
+ :x => '',
+ :y => {}
})
}
context 'list' do
it '/**' do
- list_should_yield_paths(fs, '/**', '/', '/a', '/x', '/a/aa', '/a/aa/c', '/a/aa/zz', '/a/ab', '/a/ab/c')
+ list_should_yield_paths(fs, '/**', '/', '/a', '/x', '/y', '/a/aa', '/a/aa/c', '/a/aa/zz', '/a/ab', '/a/ab/c')
end
it '/' do
list_should_yield_paths(fs, '/', '/')
end
it '/*' do
- list_should_yield_paths(fs, '/*', '/', '/a', '/x')
+ list_should_yield_paths(fs, '/*', '/', '/a', '/x', '/y')
end
it '/*/*' do
list_should_yield_paths(fs, '/*/*', '/a/aa', '/a/ab')
@@ -127,8 +128,20 @@ describe Chef::ChefFS::FileSystem do
it 'resolves /a/aa/zz' do
Chef::ChefFS::FileSystem.resolve_path(fs, '/a/aa/zz').path.should == '/a/aa/zz'
end
- it 'resolves nonexistent /y/x/w' do
- Chef::ChefFS::FileSystem.resolve_path(fs, '/y/x/w').path.should == '/y/x/w'
+ it 'resolves nonexistent /q/x/w' do
+ Chef::ChefFS::FileSystem.resolve_path(fs, '/q/x/w').path.should == '/q/x/w'
+ end
+ end
+
+ context 'empty?' do
+ it 'is not empty /' do
+ Chef::ChefFS::FileSystem.resolve_path(fs, '/').empty?.should be false
+ end
+ it 'is empty /y' do
+ Chef::ChefFS::FileSystem.resolve_path(fs, '/y').empty?.should be true
+ end
+ it 'is not a directory and can\'t be tested /x' do
+ lambda { Chef::ChefFS::FileSystem.resolve_path(fs, '/x').empty? }.should raise_error(NoMethodError)
end
end
end