Sha256: 3809e006fd2560cdbe0e6e9f5cc4eff87a6f169c5bf974300efc5e52d970f557

Contents?: true

Size: 861 Bytes

Versions: 10

Compression:

Stored size: 861 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 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
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

10 entries across 10 versions & 1 rubygems

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