Sha256: acedae6179219cebbe3193679307393d3672feb75ebbfeba9c2257384fb94798

Contents?: true

Size: 599 Bytes

Versions: 2

Compression:

Stored size: 599 Bytes

Contents

require 'spec/spec_helper'

describe "Basic object", "json" do
  it "should convert to json" do
    
    test = Class.new do 
      include Hashify::Json
      attr_accessor :prop1
      hash_accessor :prop1
    end
    
    t = test.new
    t.prop1 = 'property_value_1'
    t.to_json.should == '{"prop1":"property_value_1"}'
  end

  it "should convert from json" do
    
    test = Class.new do 
      include Hashify::Json
      attr_accessor :prop1
      hash_accessor :prop1
    end
    
    t = test.from_json '{"prop1":"property_value_1"}'
    t.prop1.should == 'property_value_1'
  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hashify-0.0.3 spec/json_spec.rb
hashify-0.0.2 spec/json_spec.rb