Sha256: 0aed6e55e2abf50200f5ef4da3de5b8a756cca0cf02100960c095ea56948794e

Contents?: true

Size: 651 Bytes

Versions: 22

Compression:

Stored size: 651 Bytes

Contents

require 'test/unit'
require File.dirname(__FILE__) + '/../lib/json-schema'

class TestSchemaTypeAttribute < Test::Unit::TestCase
  def test_type_of_data
    assert_equal(type_of_data(String.new), 'string')
    assert_equal(type_of_data(Numeric.new), 'number')
    assert_equal(type_of_data(1), 'integer')
    assert_equal(type_of_data(true), 'boolean')
    assert_equal(type_of_data(false), 'boolean')
    assert_equal(type_of_data(Hash.new), 'object')
    assert_equal(type_of_data(nil), 'null')
    assert_equal(type_of_data(Object.new), 'any')
  end

  private

  def type_of_data(data)
    JSON::Schema::TypeAttribute.type_of_data(data)
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
json-schema-2.0.5 test/test_schema_type_attribute.rb
json-schema-2.0.4 test/test_schema_type_attribute.rb