spec/yielding_spec.rb in yaml-write-stream-1.0.2 vs spec/yielding_spec.rb in yaml-write-stream-1.0.3
- old
+ new
@@ -26,7 +26,25 @@
describe '#close' do
it 'closes the underlying stream' do
stream_writer.close
expect(stream).to be_closed
end
+
+ it 'quotes empty strings' do
+ stream_writer.write_map do |map_writer|
+ map_writer.write_key_value('foo', '')
+ end
+
+ stream_writer.close
+ expect(stream.string).to eq("foo: \"\"\n")
+ end
+
+ it 'writes nils as blank entries' do
+ stream_writer.write_map do |map_writer|
+ map_writer.write_key_value('foo', nil)
+ end
+
+ stream_writer.close
+ expect(stream.string).to eq("foo: \n")
+ end
end
end