Sha256: 8114d21cb92029fc805f54fa21a963d49a2800d0914647a88090ba33cf35177a

Contents?: true

Size: 848 Bytes

Versions: 5

Compression:

Stored size: 848 Bytes

Contents

# encoding: UTF-8

shared_examples 'a json stream' do
  it 'handles a simple array' do
    check_roundtrip(['abc'])
  end

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

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
json-write-stream-1.2.0 spec/shared_examples.rb
json-write-stream-1.1.0 spec/shared_examples.rb
json-write-stream-1.0.2 spec/shared_examples.rb
json-write-stream-1.0.1 spec/shared_examples.rb
json-write-stream-1.0.0 spec/shared_examples.rb