diff --git a/.travis.yml b/.travis.yml index 61e206e4..dd848724 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: "ruby" rvm: + - "1.8" - "1.9" - "2.0" - "2.1" @@ -13,3 +14,5 @@ matrix: gemfile: "gemfiles/Gemfile.yajl-ruby.x" - rvm: "2.1" gemfile: "gemfiles/Gemfile.uuidtools.x" + allow_failures: + - rvm: "1.8" diff --git a/Gemfile b/Gemfile index 6cbb9dea..bcecfce2 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,8 @@ source "https://rubygems.org" gemspec +gem "json", platform: :ruby_18 + group :development do gem "rake" end diff --git a/test/test_common_test_suite.rb b/test/test_common_test_suite.rb index 34041a41..f8318349 100644 --- a/test/test_common_test_suite.rb +++ b/test/test_common_test_suite.rb @@ -30,18 +30,18 @@ class CommonTestSuiteTest < Test::Unit::TestCase test["tests"].each do |t| err_id = "#{rel_file}: #{base_description}/#{t['description']}" - define_method("test_#{err_id}") do - skip "Known incompatibility with common test suite" if IGNORED_TESTS.include?(rel_file) - - assert_nothing_raised("Exception raised running #{err_id}") do - v = JSON::Validator.fully_validate(schema, - t["data"], - :validate_schema => true, - :version => version - ) + unless IGNORED_TESTS.include?(rel_file) + define_method("test_#{err_id}") do + assert_nothing_raised("Exception raised running #{err_id}") do + v = JSON::Validator.fully_validate(schema, + t["data"], + :validate_schema => true, + :version => version + ) + end + + assert_equal t["valid"], v.empty?, "Common test suite case failed: #{err_id}\n#{v}" end - - assert_equal t["valid"], v.empty?, "Common test suite case failed: #{err_id}\n#{v}" end end end diff --git a/test/test_custom_format.rb b/test/test_custom_format.rb index 72261f23..f01a89c5 100644 --- a/test/test_custom_format.rb +++ b/test/test_custom_format.rb @@ -5,7 +5,7 @@ class JSONSchemaCustomFormatTest < Test::Unit::TestCase def setup @all_versions = ['draft1', 'draft2', 'draft3', 'draft4'] - @format_proc = -> value { raise JSON::Schema::CustomFormatError.new("must be 42") unless value == "42" } + @format_proc = lambda { |value| raise JSON::Schema::CustomFormatError.new("must be 42") unless value == "42" } @schema_4 = { "$schema" => "http://json-schema.org/draft-04/schema#", "properties" => { diff --git a/test/test_ruby_schema.rb b/test/test_ruby_schema.rb index 7e72675b..a823465f 100644 --- a/test/test_ruby_schema.rb +++ b/test/test_ruby_schema.rb @@ -21,16 +21,16 @@ def test_string_keys def test_symbol_keys schema = { - type: 'object', - required: ["a"], - properties: { - a: {type: "integer", default: 42}, - b: {type: "integer"} + :type => 'object', + :required => ["a"], + :properties => { + :a => {:type => "integer", :default => 42}, + :b => {:type => "integer"} } } data = { - a: 5 + :a => 5 } assert(JSON::Validator.validate(schema, data)) @@ -38,15 +38,15 @@ def test_symbol_keys def test_symbol_keys_in_hash_within_array schema = { - type: 'object', - properties: { - a: { - type: "array", - items: [ + :type => 'object', + :properties => { + :a => { + :type => "array", + :items => [ { - properties: { - b: { - type: "integer" + :properties => { + :b => { + :type => "integer" } } } @@ -56,9 +56,9 @@ def test_symbol_keys_in_hash_within_array } data = { - a: [ + :a => [ { - b: 1 + :b => 1 } ] }