diff --git a/.travis.yml b/.travis.yml index 4b4449b395..ca4e706125 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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+ diff --git a/lib/graphql/id_type.rb b/lib/graphql/id_type.rb index 96ab15aaee..b4fa599688 100644 --- a/lib/graphql/id_type.rb +++ b/lib/graphql/id_type.rb @@ -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 diff --git a/spec/graphql/schema/validation_spec.rb b/spec/graphql/schema/validation_spec.rb index 40c484fb3e..43f9b8c242 100644 --- a/spec/graphql/schema/validation_spec.rb +++ b/spec/graphql/schema/validation_spec.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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