Sha256: d9556740fc365e498ffe0a6c9a1c545abfd20af2ac49acc3808cf37e64ef0782

Contents?: true

Size: 944 Bytes

Versions: 1

Compression:

Stored size: 944 Bytes

Contents

# encoding: UTF-8

shared_examples 'a json stream' do |options = {}|
  it 'handles a simple array' do
    check_roundtrip(['abc'], options)
  end

  it 'handles a simple object' do
    check_roundtrip({ 'foo' => 'bar' }, options)
  end

  it 'handles one level of array nesting' do
    check_roundtrip([['def'],'abc'], options)
    check_roundtrip(['abc',['def']], options)
  end

  it 'handles one level of object nesting' do
    check_roundtrip({ 'foo' => { 'bar' => 'baz' } }, options)
  end

  it 'handles one level of mixed nesting' do
    check_roundtrip({ 'foo' => ['bar', 'baz'] }, options)
    check_roundtrip([{ 'foo' => 'bar' }], options)
  end

  it 'handles multiple levels of mixed nesting' do
    check_roundtrip({'foo' => ['bar', { 'baz' => 'moo', 'gaz' => ['doo'] }, 'kal'], 'jim' => ['jill', ['john']] }, options)
    check_roundtrip(['foo', { 'bar' => 'baz', 'moo' => ['gaz', ['jim', ['jill']], 'jam'] }], options)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
json-write-stream-2.0.0 spec/shared_examples.rb