Sha256: 65e00d83714c7b786a7316b4184c3c91f4a60acd4214ba8963704d4976116308

Contents?: true

Size: 623 Bytes

Versions: 4

Compression:

Stored size: 623 Bytes

Contents

require File.expand_path('../test_helper', __FILE__)

class TestSchemaTypeAttribute < Minitest::Test
  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

4 entries across 4 versions & 2 rubygems

Version Path
json-schema-openc-fork-0.0.2 test/test_schema_type_attribute.rb
json-schema-2.5.1 test/test_schema_type_attribute.rb
json-schema-openc-fork-0.0.1 test/test_schema_type_attribute.rb
json-schema-2.5.0 test/test_schema_type_attribute.rb