spec/graphql/schema/object_spec.rb in graphql-1.8.6 vs spec/graphql/schema/object_spec.rb in graphql-1.8.7

- old
+ new

@@ -2,10 +2,11 @@ require "spec_helper" describe GraphQL::Schema::Object do describe "class attributes" do let(:object_class) { Jazz::Ensemble } + it "tells type data" do assert_equal "Ensemble", object_class.graphql_name assert_equal "A group of musicians playing together", object_class.description assert_equal 6, object_class.fields.size assert_equal 3, object_class.interfaces.size @@ -49,9 +50,23 @@ it "raise on anonymous class without declared graphql name" do anonymous_class = Class.new(GraphQL::Schema::Object) assert_raises NotImplementedError do anonymous_class.graphql_name end + end + + class OverrideNameObject < GraphQL::Schema::Object + class << self + def default_graphql_name + "Override" + end + end + end + + it "can override the default graphql_name" do + override_name_object = OverrideNameObject + + assert_equal "Override", override_name_object.graphql_name end end describe "implementing interfaces" do it "raises an error when trying to implement a non-interface module" do