Permalink
Browse files

pathname cleanup

  • Loading branch information...
1 parent 21dd68b commit fb99b44567f3f26635cc72abf423af8e7dce32d6 @quix committed Aug 9, 2009
Showing with 8 additions and 7 deletions.
  1. +3 −3 lib/quix/ext/pathname.rb
  2. +5 −4 test/test_pathname.rb
View
6 lib/quix/ext/pathname.rb
@@ -58,9 +58,9 @@ def replace(open_flags_read = ["r"], open_flags_write = ["w"])
}
end
- BINARY_ENCODING = RUBY_VERSION < "1.9" ? "" : ":ASCII-8BIT"
- BINARY_READ_FLAGS = "rb" + BINARY_ENCODING
- BINARY_WRITE_FLAGS = "wb" + BINARY_ENCODING
+ binary_encoding = RUBY_VERSION < "1.9" ? "" : ":ASCII-8BIT"
+ BINARY_READ_FLAGS = "rb" + binary_encoding
+ BINARY_WRITE_FLAGS = "wb" + binary_encoding
unless method_defined?(:binread)
def binread(length = nil, offset = nil)
View
9 test/test_pathname.rb
@@ -145,7 +145,7 @@ def test_glob_files
if File::ALT_SEPARATOR == "\\"
def test_initialize
- assert_equal "a/b/c", Pathname("a\\b\\c").to_s
+ assert_equal Pathname("a/b/c"), Pathname("a\\b\\c")
end
end
@@ -154,8 +154,9 @@ def test_copy_to
contents = "abab"
source.write(contents)
assert(!dest.exist?)
- source.copy_to(dest)
- assert contents, source.read
- assert contents, dest.read
+ result = source.copy_to(dest)
+ assert_equal contents, source.read
+ assert_equal contents, dest.read
+ assert_equal dest, result
end
end

0 comments on commit fb99b44

Please sign in to comment.