Sha256: 366b64325752a42b6ce9107a5460004ef7e7789b58c3775cbb95292b86f1f5b0

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

require 'test_helper'

class TestJsonSchema < Minitest::Test

  def setup
    sampole_schema_file = File.expand_path('doc/schemas/account_post_request_body.schema.json', File.dirname(__FILE__))
    @schema_json = JSON.load(File.open(sampole_schema_file).read)
  end

  def test_objects_method_returns_array
    schema = Swagui::JsonSchema.new(@schema_json, 'PostAccount')
    assert_equal schema.all_objects.size, 2
  end

  def test_models_methods_return_array_of_hash
    schema = Swagui::JsonSchema.new(@schema_json, 'PostAccount')
    assert_equal schema.models.size, 2
    assert_equal schema.models.map {|x| x['id']}, ['PostAccount', 'PostAccount-contact']
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
swagui-0.2.1 test/test_json_schema.rb
swagui-0.2.0 test/test_json_schema.rb