Sha256: 5b843db224bf6b14b1915069b4b4f3d2121ae4cfefd738477665c1366337d95f

Contents?: true

Size: 897 Bytes

Versions: 8

Compression:

Stored size: 897 Bytes

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 Array" do
  specify "should create json" do
    array = [1, 'hello', :hello]
    array.to_json.should_equal '[1,"hello","hello"]'
  end
end

context "A multi-dimensional Array" do
  specify "should create json" do
    array = [1, ['hello', [:hello]]]
    array.to_json.should_equal '[1,["hello",["hello"]]]'
  end

  specify "should not support circular dependencies" do
    array = []
    array << 1
    array << ['hello', array]
    proc {array.to_json}.should_raise JSON::CircularDatastructure
  end
end

#context "Array performance" do
#  specify "" 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

8 entries across 8 versions & 1 rubygems

Version Path
fjson-0.0.1 spec/array_spec.rb
fjson-0.0.2 spec/array_spec.rb
fjson-0.0.3 spec/array_spec.rb
fjson-0.0.4 spec/array_spec.rb
fjson-0.0.5 spec/array_spec.rb
fjson-0.0.6 spec/array_spec.rb
fjson-0.0.7 spec/array_spec.rb
fjson-0.0.8 spec/array_spec.rb