Skip to content

Commit 2186b80

Browse files
committed
Add a test case for use of :base and tag it
1 parent d2532c2 commit 2186b80

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

spec/ruby/core/dir/glob_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@
2929
%w!file_one.ext file_two.ext!
3030
end
3131

32+
it 'returns matching file paths when supplied :base keyword argument' do
33+
dir = tmp('temp') + '/'
34+
file_1 = dir + 'lib/bloop.rb'
35+
file_2 = dir + 'lib/soup.rb'
36+
file_3 = dir + 'lib/mismatched_file_type.txt'
37+
file_4 = dir + 'mismatched_directory.rb'
38+
39+
touch file_1
40+
touch file_2
41+
touch file_3
42+
touch file_4
43+
44+
Dir.glob('**/*.rb', base: dir + 'lib').sort.should == ["bloop.rb", "soup.rb"].sort
45+
46+
rm_r dir[0...-1]
47+
end
48+
3249
it "calls #to_path to convert multiple patterns" do
3350
pat1 = mock('file_one.ext')
3451
pat1.should_receive(:to_path).and_return('file_one.ext')

spec/tags/core/dir/glob_tags.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
fails:Dir.glob recursively matches files and directories in nested dot subdirectory with 'nested/**/*' from the current directory and option File::FNM_DOTMATCH
2+
fails:Dir.glob returns matching file paths when supplied :base keyword argument

0 commit comments

Comments
 (0)