Sha256: ec1d3c855b4fe2278f1c4d3a9ccf67b50e72fffba561001d7d5a722c6435e525
Contents?: true
Size: 992 Bytes
Versions: 6
Compression:
Stored size: 992 Bytes
Contents
require 'spec_helper' describe Jsonify::Generate do let(:links) do { :links => [ {:rel => 'foo', :href => 'goo'}, {:rel => 'bar', :href => 'baz'} ] } end it 'should build json' do json = Jsonify::Generate result = json.value links expected = '{"links":[{"rel":"foo","href":"goo"},{"rel":"bar","href":"baz"}]}' JSON.parse(result.to_json).should == JSON.parse(expected) end describe 'complex example' do let(:jsonifier) { Jsonify::Generate } it 'should work' do json = jsonifier.object_value( {"links" => jsonifier.array_value([ jsonifier.object_value( {"rel" => "foo", "href" => "goo"} ), jsonifier.object_value( {"rel" => "bar", "href" => "baz"} ) ]) } ) expected = "{\"links\":[{\"rel\":\"foo\",\"href\":\"goo\"},{\"rel\":\"bar\",\"href\":\"baz\"}]}" JSON.parse(json.to_json).should == JSON.parse(expected) end end end
Version data entries
6 entries across 6 versions & 1 rubygems