Sha256: 4e658f02ce01313a2aaefa3d80063043224d3d973aadb4d82dda527dafb4f78f
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require 'rubygems' require 'spec' dir = File.dirname(__FILE__) require File.expand_path("#{dir}/spec_helper") require File.expand_path("#{dir}/../lib/fjson") describe "A one dimensional Array" do it "should create json" do array = [1, 'hello', :hello] array.to_json.should == '[1,"hello","hello"]' end it "should allow child object to have to_json with no arguments" do obj = Object.new def obj.to_json "json".to_json end array = [obj] array.to_json.should == "[\"json\"]" end end describe "A multi-dimensional Array" do it "should create json" do array = [1, ['hello', [:hello]]] array.to_json.should == '[1,["hello",["hello"]]]' end it "should not support circular dependencies" do array = [] array << 1 array << ['hello', array] proc {array.to_json}.should raise_error JSON::CircularDatastructure end end #describe "Array performance" do # it "" do # begin_time = Time.now # 100000.times do # [1, ['hello', [:hello]]].to_json # end # puts "#{Time.now - begin_time} seconds" # end #end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fjson-0.1.2 | spec/array_spec.rb |