Sha256: a52cdfa5d1e6bedecb4635c227d380536f224c5a38c7d83b4ea4d713c1bcc947

Contents?: true

Size: 557 Bytes

Versions: 8

Compression:

Stored size: 557 Bytes

Contents

require 'test_helper'

class TestElements < Test::Unit::TestCase
  def assert_elements_equal(value, array)
    assert_equal value, JSONBuilder::Elements.new(nil, array).to_s
  end

  def test_array_hash
    assert_elements_equal '[{"woot":true}]', [{ :woot => true }]
  end

  def test_custom_class_objects
    assert_elements_equal '["olleh", "eybdoog"]', [Dozer.new('hello'), Dozer.new('goodbye')]
  end

  def test_raises_invalid_argument
    assert_raises(JSONBuilder::InvalidArgument) {
      JSONBuilder::Elements.new(nil, false).to_s
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
json_builder-3.1.7 test/elements_test.rb
json_builder-3.1.6 test/elements_test.rb
json_builder-3.1.5 test/elements_test.rb
json_builder-3.1.4 test/elements_test.rb
json_builder-3.1.3 test/elements_test.rb
json_builder-3.1.2 test/elements_test.rb
json_builder-3.1.1 test/elements_test.rb
json_builder-3.1.0 test/elements_test.rb