Sha256: 2d669b92437c39fd5aaf6af201294dfa159a2c1398502aff0c9b0c5631535796

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

require "rubygems"
require 'lib/jsont.rb'
require 'json'
describe "JsonT was a hash" do
  
  it "should use $ references" do
    JsonT.new(
      {'self' => '<div>{$.test}</div>', 'test' => '<p>{$.x} {$.y}</p>'}
    ).transform(
      {'test' => {'x' => 1, 'y' => 2}}
    ).should == '<div><p>1 2</p></div>'
  end

  it "should transform" do
    JsonT.new(
      JSON.parse('{ "self": "<table>{pnt}</table>", "pnt": "<tr><td>{pnt.x}</td><td>{pnt.y}</td></tr>" }')
    ).transform(
      JSON.parse('{"pnt": { "x":2, "y":3 }}')
    ).should == '<table><tr><td>2</td><td>3</td></tr></table>'

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jsont-0.1.3 spec/hash.rb