Sha256: 4af07ee4d429ae3f1c9f86102bc7f0d1d005fdbe70a58e770d7d91c1c33d7293
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'rubygems' require 'spec' dir = File.dirname(__FILE__) require File.expand_path("#{dir}/spec_helper") require File.expand_path("#{dir}/../lib/fjson") context "A one dimensional Hash" do specify "should create json" do hash = { :one => 1, "hello" => :hello } json = hash.to_json json.should_include "\"one\":1" json.should_include "\"hello\":\"hello\"" end specify "should allow child object to have to_json with no arguments" do obj = Object.new def obj.to_json "json".to_json end hash = { "key" => obj } hash.to_json.should_eql "{\"key\":\"json\"}" end end context "A multi-dimensional Hash" do specify "should create json" do hash = { :one => 1, "hello" => { :hello2 => 2 }, } json = hash.to_json json.should_include "\"one\":1" json.should_include "\"hello\":{\"hello2\":2}" end specify "should not support circular dependencies" do hash = { :one => 1 } hash["hello"] = hash proc {hash.to_json}.should_raise JSON::CircularDatastructure end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fjson-0.1.1 | spec/hash_spec.rb |