Sha256: d610bbbccee0ce838936e38f2f41ded1605b8092537c3c30375c443351017ef1

Contents?: true

Size: 527 Bytes

Versions: 34

Compression:

Stored size: 527 Bytes

Contents

require 'helper'

module Bixby
module Test

class TestJsonify < MiniTest::Unit::TestCase

  def test_to_json
    j = JFoo.new
    j.bar = "baz"
    json = j.to_json
    assert json
    assert_equal '{"bar":"baz"}', json
  end

  def test_from_json
    j1 = JFoo.new
    j1.bar = "baz"

    j2 = JFoo.from_json(j1.to_json)
    assert_equal "baz", j2.bar

    j3 = JFoo.from_json('{"bar":"baz"}')
    assert_equal "baz", j3.bar
  end

end # Jsonify

class JFoo
  include Jsonify
  attr_accessor :bar
end

end # Test
end # Bixby

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
bixby-common-0.4.3 test/util/jsonify_test.rb
bixby-common-0.4.2 test/util/jsonify_test.rb
bixby-common-0.4.1 test/util/jsonify_test.rb
bixby-common-0.4.0 test/util/jsonify_test.rb
bixby-common-0.3.16 test/util/jsonify_test.rb
bixby-common-0.3.15 test/util/jsonify_test.rb
bixby-common-0.3.14 test/util/jsonify_test.rb
bixby-common-0.3.13 test/util/jsonify_test.rb
bixby-common-0.3.12 test/util/jsonify_test.rb
bixby-common-0.3.11 test/util/jsonify_test.rb
bixby-common-0.3.10 test/util/jsonify_test.rb
bixby-common-0.3.9 test/util/jsonify_test.rb
bixby-common-0.3.8 test/util/jsonify_test.rb
bixby_common-0.2.0 test/test_jsonify.rb