Skip to content

Commit 76f856b

Browse files
committed
[GR-19220] Add spec for use of :base in Dir#glob and tag it (#2377)
PullRequest: truffleruby/2730
2 parents 5593022 + 217cdbc commit 76f856b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-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('dir_glob_base')
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+
ensure
46+
rm_r dir
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')

0 commit comments

Comments
 (0)