Created
January 21, 2011 10:20
-
-
Save calavera/789505 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 33a17a694473bcfd95b4a04390a898f23923489c Mon Sep 17 00:00:00 2001 | |
From: David Calavera <[email protected]> | |
Date: Fri, 21 Jan 2011 11:19:00 +0100 | |
Subject: [PATCH] Dir.glob uses #to_path when the receiver responds to it | |
--- | |
core/dir/shared/glob.rb | 21 ++++++++++++++++----- | |
1 files changed, 16 insertions(+), 5 deletions(-) | |
diff --git a/core/dir/shared/glob.rb b/core/dir/shared/glob.rb | |
index 9f11e2e..468f401 100644 | |
--- a/core/dir/shared/glob.rb | |
+++ b/core/dir/shared/glob.rb | |
@@ -8,14 +8,25 @@ describe :dir_glob, :shared => true do | |
Dir.chdir @cwd | |
end | |
- it "converts patterns with to_str" do | |
- obj = mock('file_one.ext') | |
- obj.should_receive(:to_str).and_return('file_one.ext') | |
+ ruby_version_is ""..."1.9" do | |
+ it "converts patterns with to_str" do | |
+ obj = mock('file_one.ext') | |
+ obj.should_receive(:to_str).and_return('file_one.ext') | |
- Dir.send(@method, obj).should == %w[file_one.ext] | |
+ Dir.send(@method, obj).should == %w[file_one.ext] | |
+ end | |
+ end | |
+ | |
+ ruby_version_is "1.9" do | |
+ it "converts patterns with to_path" do | |
+ obj = mock('file_one.ext') | |
+ obj.should_receive(:to_path).and_return('file_one.ext') | |
+ | |
+ Dir.send(@method, obj).should == %w[file_one.ext] | |
+ end | |
end | |
- it "splits the string on \0 if there is only one string given" do | |
+ it "splits the string on \\0 if there is only one string given" do | |
Dir.send(@method, "file_o*\0file_t*").should == | |
%w!file_one.ext file_two.ext! | |
end | |
-- | |
1.7.0.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment