Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ruby 1.8 to travis #154

Merged
merged 8 commits into from
Oct 28, 2014
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: "ruby"
rvm:
- "1.8"
- "1.9"
- "2.0"
- "2.1"
Expand All @@ -13,3 +14,5 @@ matrix:
gemfile: "gemfiles/Gemfile.yajl-ruby.x"
- rvm: "2.1"
gemfile: "gemfiles/Gemfile.uuidtools.x"
allow_failures:
- rvm: "1.8"
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ source "https://rubygems.org"

gemspec

gem "json", platform: :ruby_18

group :development do
gem "rake"
end
22 changes: 11 additions & 11 deletions test/test_common_test_suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_custom_format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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" => {
Expand Down
32 changes: 16 additions & 16 deletions test/test_ruby_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@ 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))
end

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"
}
}
}
Expand All @@ -56,9 +56,9 @@ def test_symbol_keys_in_hash_within_array
}

data = {
a: [
:a => [
{
b: 1
:b => 1
}
]
}
Expand Down