spec/graphql/schema/object_spec.rb in graphql-1.9.7 vs spec/graphql/schema/object_spec.rb in graphql-1.9.8
- old
+ new
@@ -310,6 +310,27 @@
# TBH I think `{}` is probably righter than `nil`, I guess we'll see.
skip_value = TESTING_INTERPRETER ? {} : nil
assert_equal({"data" => skip_value }, res.to_h)
end
end
+
+ describe "when fields conflict with built-ins" do
+ it "warns when no override" do
+ expected_warning = "X's `field :method` conflicts with a built-in method, use `resolver_method:` to pick a different resolver method for this field (for example, `resolver_method: :resolve_method` and `def resolve_method`)\n"
+ assert_output "", expected_warning do
+ Class.new(GraphQL::Schema::Object) do
+ graphql_name "X"
+ field :method, String, null: true
+ end
+ end
+ end
+
+ it "doesn't warn with an override" do
+ assert_output "", "" do
+ Class.new(GraphQL::Schema::Object) do
+ graphql_name "X"
+ field :method, String, null: true, resolver_method: :resolve_method
+ end
+ end
+ end
+ end
end