Sha256: 3763c839aa416266621dbeed06804897f5a1000f006fd62e7d2116fca0665b68

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

require 'test_helper'

class TestExtensions < Test::Unit::TestCase
  def test_string_respond_to
    assert_respond_to 'json_builder', :to_builder
  end

  def test_ordered_hash
    assert_respond_to ActiveSupport::OrderedHash.new(:json_builder => true), :to_builder
  end

  def test_true_value
    assert_respond_to true, :to_builder
  end

  def test_false_value
    assert_respond_to false, :to_builder
  end

  def test_hash_value
    assert_respond_to({ :json_builder => true }, :to_builder)
  end

  def test_nil_value
    assert_respond_to nil, :to_builder
  end

  def test_time_with_zone_value
    assert_respond_to Time.zone.now, :to_builder
  end

  def test_time_value
    assert_respond_to Time.utc(2012), :to_builder
  end

  def test_date_value
    assert_respond_to Date.parse('2012-01-01'), :to_builder
  end

  def test_datetime_value
    assert_respond_to DateTime.parse('2012-01-01'), :to_builder
  end

  def test_bson_objectid_value
    assert_respond_to BSON::ObjectId.new, :to_builder
  end

  def test_custom_class
    assert_respond_to Dozer.new('hello'), :to_builder
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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