Sha256: d6a26136f93a39eadf8f6b6eecdb3822efdc8709f51549d7b73db88493243b9b
Contents?: true
Size: 1022 Bytes
Versions: 2
Compression:
Stored size: 1022 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"}]}' MultiJson.load(result.encode_as_json).should == MultiJson.load(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\"}]}" MultiJson.load(json.encode_as_json).should == MultiJson.load(expected) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jsonify-0.4.1 | spec/generate_spec.rb |
jsonify-0.4.0 | spec/generate_spec.rb |