spec/graphql/upgrader/member_spec.rb in graphql-1.8.0.pre10 vs spec/graphql/upgrader/member_spec.rb in graphql-1.8.0.pre11

- old
+ new

@@ -109,14 +109,16 @@ UserInterface = GraphQL::InterfaceType.define do name "User" end } new = %{ - class UserInterface < Types::BaseInterface + module UserInterface + include Types::BaseInterface graphql_name "User" end } + assert_equal new, upgrade(old) old = %{ UserEnum = GraphQL::EnumType.define do name "User" @@ -137,14 +139,20 @@ end} new = %{class UserType < Types::BaseObject end} assert_equal new, upgrade(old) - old = %{UserInterface = GraphQL::InterfaceType.define do - end} - new = %{class UserInterface < Types::BaseInterface - end} + old = <<-RUBY +UserInterface = GraphQL::InterfaceType.define do +end +RUBY + new = <<-RUBY +module UserInterface + include Types::BaseInterface +end +RUBY + assert_equal new, upgrade(old) old = %{UserUnion = GraphQL::UnionType.define do end} new = %{class UserUnion < Types::BaseUnion @@ -472,10 +480,10 @@ def custom_upgrade(original_text) # Replace the default one with a custom one: type_transforms = GraphQL::Upgrader::Member::DEFAULT_TYPE_TRANSFORMS.map { |t| if t == GraphQL::Upgrader::TypeDefineToClassTransform - GraphQL::Upgrader::TypeDefineToClassTransform.new(base_class_pattern: "Platform::\\2s::Base") + GraphQL::Upgrader::TypeDefineToClassTransform.new(base_class_pattern: "Platform::\\3s::Base") else t end }