Skip to content

Commit 68eaaf0

Browse files
committed
Use shorthand helper method to force a string to binary encoding (#b)
1 parent 5309d09 commit 68eaaf0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

core/io/write_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
ë = ([235].pack('U')).encode('ISO-8859-1')
149149
ö = ([246].pack('U')).encode('ISO-8859-1')
150150
res = "H#{ë}ll#{ö}"
151-
File.binread(@filename).should == res.force_encoding(Encoding::BINARY)
151+
File.binread(@filename).should == res.b
152152
end
153153

154154
it "writes binary data with newline conversion if no encoding is given" do
@@ -158,7 +158,7 @@
158158
ë = ([235].pack('U')).encode('ISO-8859-1')
159159
ö = ([246].pack('U')).encode('ISO-8859-1')
160160
res = "H#{ë}ll#{ö}\r\n"
161-
File.binread(@filename).should == res.force_encoding(Encoding::BINARY)
161+
File.binread(@filename).should == res.b
162162
end
163163

164164
it "writes binary data with newline conversion if encoding is ASCII-8BIT" do
@@ -168,7 +168,7 @@
168168
ë = ([235].pack('U')).encode('ISO-8859-1')
169169
ö = ([246].pack('U')).encode('ISO-8859-1')
170170
res = "H#{ë}ll#{ö}\r\n"
171-
File.binread(@filename).should == res.force_encoding(Encoding::BINARY)
171+
File.binread(@filename).should == res.b
172172
end
173173
end
174174

0 commit comments

Comments
 (0)