From 97b96f14b631bdfbbf36a0535657487151d9413b Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Thu, 5 Jan 2017 23:27:08 -0500 Subject: [PATCH 1/4] test on Ruby 2.4 --- .travis.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4b4449b395..1bb511f9cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,8 @@ env: CODECLIMATE_REPO_TOKEN=f5b27b2e25d3f4e199bb2566fb4fd4507144a004c71d4aa33a32 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 +18,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+ From af5adad155d99c6b821529cc6305034f37e7c0ac Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Tue, 14 Feb 2017 07:02:54 -0500 Subject: [PATCH 2/4] update for integer unification --- lib/graphql/id_type.rb | 2 +- spec/graphql/schema/validation_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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..057017d4c1 100644 --- a/spec/graphql/schema/validation_spec.rb +++ b/spec/graphql/schema/validation_spec.rb @@ -102,7 +102,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" end end @@ -129,7 +129,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" assert_error_includes invalid_interface_member_object, "must contain GraphQL::InterfaceType, not Symbol" end @@ -163,7 +163,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" assert_error_includes non_object_type_union, "must contain GraphQL::ObjectType, not GraphQL::InterfaceType" end @@ -193,7 +193,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 => Symbol" end it "applies validation to its member Arguments" do From f9ad6ec1465ec20851f561020622bdf074091dd4 Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Tue, 14 Feb 2017 07:08:08 -0500 Subject: [PATCH 3/4] support both integer classes in tests --- spec/graphql/schema/validation_spec.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/spec/graphql/schema/validation_spec.rb b/spec/graphql/schema/validation_spec.rb index 057017d4c1..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 Integer" + 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 Integer" + 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 Integer" + 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 Integer => 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 From e7ad88b6429f4e9c3242963a3a1738a421108e34 Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Sun, 19 Feb 2017 09:59:26 -0500 Subject: [PATCH 4/4] fix?(2.4) update rubygems before travis run --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 1bb511f9cb..ca4e706125 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,9 @@ 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