diff --git a/lib/zstd-ruby/stream_writer.rb b/lib/zstd-ruby/stream_writer.rb index 3e379bf..78ac4db 100644 --- a/lib/zstd-ruby/stream_writer.rb +++ b/lib/zstd-ruby/stream_writer.rb @@ -3,7 +3,7 @@ module Zstd class StreamWriter def initialize(io, level: nil) @io = io - @stream = Zstd::StreamingCompress.new(level) + @stream = Zstd::StreamingCompress.new(level: level) end def write(*data) diff --git a/spec/zstd-ruby-stream_writer_spec.rb b/spec/zstd-ruby-stream_writer_spec.rb index 369aab5..3c555fb 100644 --- a/spec/zstd-ruby-stream_writer_spec.rb +++ b/spec/zstd-ruby-stream_writer_spec.rb @@ -13,4 +13,14 @@ expect(Zstd.decompress(io.read)).to eq('abcdef') end end + describe 'level' do + it 'should work' do + io = StringIO.new + stream = Zstd::StreamWriter.new(io, level: 5) + stream.write("abcdef") + stream.finish + io.rewind + expect(Zstd.decompress(io.read)).to eq('abcdef') + end + end end