Skip to content

Commit

Permalink
Merge pull request #1196 from skalee/invalid-bytes-handling
Browse files Browse the repository at this point in the history
Fix test example
  • Loading branch information
lsegal committed Jul 2, 2019
2 parents db437f8 + 4d18bba commit 660b8ea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spec/code_objects/extra_file_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@
it "attempts to re-parse data as 8-bit ascii if parsing fails" do
expect(log).not_to receive(:warn)
str, out = *([String.new("\xB0")] * 2)
if str.respond_to?(:force_encoding)
str.force_encoding('utf-8')
out.force_encoding('binary')
if str.respond_to?(:force_encoding!)
str.force_encoding!('utf-8')
out.force_encoding!('binary')
end
expect(str.valid_encoding?).to be(false)
file = ExtraFileObject.new('file.txt', str)
expect(file.contents).to eq out
end
Expand Down

0 comments on commit 660b8ea

Please sign in to comment.