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.4.1 test/test_schema_type_attribute.rb
json-schema-2.4.0 test/test_schema_type_attribute.rb
json-schema-2.3.0 test/test_schema_type_attribute.rb
json-schema-2.2.5 test/test_schema_type_attribute.rb
json-schema-pvdgm-2.3.1 test/test_schema_type_attribute.rb
json-schema-2.2.4 test/test_schema_type_attribute.rb
json-schema-2.2.3 test/test_schema_type_attribute.rb
json-schema-2.2.2 test/test_schema_type_attribute.rb
json-schema-2.2.1 test/test_schema_type_attribute.rb
json-schema-2.2.0 test/test_schema_type_attribute.rb
json-schema-2.1.9 test/test_schema_type_attribute.rb
json-schema-2.1.8 test/test_schema_type_attribute.rb
json-schema-2.1.7 test/test_schema_type_attribute.rb
json-schema-2.1.6 test/test_schema_type_attribute.rb
json-schema-2.1.5 test/test_schema_type_attribute.rb
json-schema-2.1.4 test/test_schema_type_attribute.rb
json-schema-2.1.3 test/test_schema_type_attribute.rb
json-schema-2.1.2 test/test_schema_type_attribute.rb
json-schema-2.1.1 test/test_schema_type_attribute.rb
json-schema-2.1.0 test/test_schema_type_attribute.rb