Sha256: 6e687abcb7c2cce50b29b708e2b48f92b3efe132acdbdea4d192a65e315edb22
Contents?: true
Size: 1.53 KB
Versions: 45
Compression:
Stored size: 1.53 KB
Contents
# frozen_string_literal: true require "spec_helper" require './lib/graphql/upgrader/schema.rb' describe GraphQL::Upgrader::Schema do def upgrade(old) GraphQL::Upgrader::Schema.new(old).upgrade end it 'updates the definition' do old = %{ StarWarsSchema = GraphQL::Schema.define do end } new = %{ class StarWarsSchema < GraphQL::Schema end } assert_equal upgrade(old), new end it 'updates the resolve_type' do old = %{ StarWarsSchema = GraphQL::Schema.define do resolve_type ->(obj, ctx) do nil end end } new = %{ class StarWarsSchema < GraphQL::Schema def self.resolve_type(obj, ctx) nil end end } assert_equal upgrade(old), new end it 'updates the object_from_id' do old = %{ StarWarsSchema = GraphQL::Schema.define do object_from_id ->(id, ctx) do nil end end } new = %{ class StarWarsSchema < GraphQL::Schema def self.object_from_id(id, ctx) nil end end } assert_equal upgrade(old), new end it 'updates the id_from_object' do old = %{ StarWarsSchema = GraphQL::Schema.define do id_from_object -> (object, type_definition, ctx) do nil end end } new = %{ class StarWarsSchema < GraphQL::Schema def self.id_from_object(object, type_definition, ctx) nil end end } assert_equal upgrade(old), new end end
Version data entries
45 entries across 45 versions & 1 rubygems