10000 Prefer the simple read/write `File` singleton methods · jeremyevans/ruby@d4a53b4 · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit d4a53b4

Browse files
committed
Prefer the simple read/write File singleton methods
1 parent 137b52a commit d4a53b4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

spec/ruby/library/net-ftp/shared/puttextfile.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
it "sends the contents of the passed local_file, using \\r\\n as the newline separator" do
2828
@ftp.send(@method, @local_fixture_file, "text")
2929

30-
remote_lines = open(@remote_tmp_file, "rb") {|f| f.read }
31-
local_lines = open(@local_fixture_file, "rb") {|f| f.read }
30+
remote_lines = File.binread(@remote_tmp_file)
31+
local_lines = File.binread(@local_fixture_file)
3232

3333
remote_lines.should_not == local_lines
3434
remote_lines.should == local_lines.gsub("\n", "\r\n")

test/ruby/test_dir_m17n.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def with_enc_path
318318

319319
def test_glob_warning_opendir
320320
with_enc_path do |dir|
321-
open("#{dir}/x", "w") {}
321+
File.binwrite("#{dir}/x", "")
322322
File.chmod(0300, dir)
323323
next if File.readable?(dir)
324324
assert_warning(/#{dir}/) do
@@ -329,7 +329,7 @@ def test_glob_warning_opendir
329329

330330
def test_glob_warning_match_all
331331
with_enc_path do |dir|
332-
open("#{dir}/x", "w") {}
332+
File.binwrite("#{dir}/x", "")
333333
File.chmod(0000, dir)
334334
next if File.readable?(dir)
335335
assert_warning(/#{dir}/) do

0 commit comments

Comments
 (0)
0