spec/spec_helper.rb in json-write-stream-1.2.0 vs spec/spec_helper.rb in json-write-stream-2.0.0
- old
+ new
@@ -1,23 +1,22 @@
# encoding: UTF-8
require 'rspec'
require 'json-write-stream'
require 'shared_examples'
-require 'pry-nav'
+require 'pry-byebug'
RSpec.configure do |config|
- config.mock_with :rr
end
class RoundtripChecker
class << self
include RSpec::Matchers
- def check_roundtrip(obj)
+ def check_roundtrip(obj, options = {})
stream = StringIO.new
- writer = create_writer(stream)
+ writer = create_writer(stream, options)
serialize(obj, writer)
writer.close
new_obj = JSON.parse(stream.string)
compare(obj, new_obj)
end
@@ -47,12 +46,12 @@
class YieldingRoundtripChecker < RoundtripChecker
class << self
protected
- def create_writer(stream)
- JsonWriteStream::YieldingWriter.new(stream)
+ def create_writer(stream, options = {})
+ JsonWriteStream::YieldingWriter.new(stream, options)
end
def serialize(obj, writer)
case obj
when Hash
@@ -104,11 +103,11 @@
class StatefulRoundtripChecker < RoundtripChecker
class << self
protected
- def create_writer(stream)
- JsonWriteStream::StatefulWriter.new(stream)
+ def create_writer(stream, options = {})
+ JsonWriteStream::StatefulWriter.new(stream, options)
end
def serialize(obj, writer)
case obj
when Hash