Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ language: ruby
sudo: false
cache: bundler
env: CODECLIMATE_REPO_TOKEN=f5b27b2e25d3f4e199bb2566fb4fd4507144a004c71d4aa33a32c2df5f940333
before_install:
- gem update --system --no-doc
- gem install bundler

rvm:
- 2.1.0 # Lowest version officially supported by that gem
- 2.2.5
- 2.3.1
- 2.3.3
- 2.4.0

gemfile:
- gemfiles/rails_3.2.gemfile
Expand All @@ -17,5 +21,11 @@ gemfile:

matrix:
exclude:
- rvm: 2.4.0
gemfile: gemfiles/rails_3.2.gemfile
- rvm: 2.4.0
gemfile: gemfiles/rails_4.1.gemfile
- rvm: 2.4.0
gemfile: gemfiles/rails_4.2.gemfile
- rvm: 2.1.0
gemfile: gemfiles/rails_5.0.gemfile # Rails 5 requires Ruby 2.2.2+
2 changes: 1 addition & 1 deletion lib/graphql/id_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
coerce_result ->(value) { value.to_s }
coerce_input ->(value) {
case value
when String, Fixnum, Bignum
when String, Integer
value.to_s
else
nil
Expand Down
12 changes: 8 additions & 4 deletions spec/graphql/schema/validation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
require "spec_helper"

describe GraphQL::Schema::Validation do
def integer_class_name
RUBY_VERSION >= "2.4.0" ? "Integer" : "Fixnum"
end

def assert_error_includes(object, error_substring)
validation_error = GraphQL::Schema::Validation.validate(object)
assert_includes validation_error, error_substring
Expand Down Expand Up @@ -102,7 +106,7 @@ def assert_validation_warns(object, warning)
end

it "requires String-or-nil description" do
assert_error_includes wrongly_described_type, "must return String or NilClass, not Fixnum"
assert_error_includes wrongly_described_type, "must return String or NilClass, not #{integer_class_name}"
end
end

Expand All @@ -129,7 +133,7 @@ def assert_validation_warns(object, warning)
}

it "requires an Array for interfaces" do
assert_error_includes invalid_interfaces_object, "must be an Array of GraphQL::InterfaceType, not a Fixnum"
assert_error_includes invalid_interfaces_object, "must be an Array of GraphQL::InterfaceType, not a #{integer_class_name}"
assert_error_includes invalid_interface_member_object, "must contain GraphQL::InterfaceType, not Symbol"
end

Expand Down Expand Up @@ -163,7 +167,7 @@ def assert_validation_warns(object, warning)
}

it "requires an array of ObjectTypes for possible_types" do
assert_error_includes non_array_union, "must be an Array of GraphQL::ObjectType, not a Fixnum"
assert_error_includes non_array_union, "must be an Array of GraphQL::ObjectType, not a #{integer_class_name}"

assert_error_includes non_object_type_union, "must contain GraphQL::ObjectType, not GraphQL::InterfaceType"
end
Expand Down Expand Up @@ -193,7 +197,7 @@ def assert_validation_warns(object, warning)
}

it "requires {String => Argument} arguments" do
assert_error_includes invalid_arguments_input, "map String => GraphQL::Argument, not Fixnum => Symbol"
assert_error_includes invalid_arguments_input, "map String => GraphQL::Argument, not #{integer_class_name} => Symbol"
end

it "applies validation to its member Arguments" do
Expand Down