test/encode_reader_test.rb in iostreams-0.20.3 vs test/encode_reader_test.rb in iostreams-1.0.0.beta
- old
+ new
@@ -20,31 +20,31 @@
describe '#read' do
describe 'replacement' do
it 'does not strip invalid characters' do
input = StringIO.new(bad_data)
- IOStreams::Encode::Reader.open(input, encoding: 'UTF-8') do |io|
+ IOStreams::Encode::Reader.stream(input, encoding: 'UTF-8') do |io|
assert_raises ::Encoding::UndefinedConversionError do
io.read.encoding
end
end
end
it 'strips invalid characters' do
input = StringIO.new(bad_data)
data =
- IOStreams::Encode::Reader.open(input, encoding: 'UTF-8', encode_replace: '') do |io|
+ IOStreams::Encode::Reader.stream(input, encoding: 'UTF-8', replace: '') do |io|
io.read
end
assert_equal cleansed_data, data
end
end
describe 'printable' do
it 'strips non-printable characters' do
input = StringIO.new(bad_data)
data =
- IOStreams::Encode::Reader.open(input, encoding: 'UTF-8', encode_cleaner: :printable, encode_replace: '') do |io|
+ IOStreams::Encode::Reader.stream(input, encoding: 'UTF-8', cleaner: :printable, replace: '') do |io|
io.read
end
assert_equal stripped_data, data
end
end