Sha256: eac53384748c10dcfe71e647a1c66d0e8f41c4dc8935c67b263c5e8804373eba
Contents?: true
Size: 1.08 KB
Versions: 9
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require "spec_helper" require "generators/graphql/object_generator" class GraphQLGeneratorsObjectGeneratorTest < BaseGeneratorTest tests Graphql::Generators::ObjectGenerator test "it generates fields with types" do commands = [ # GraphQL-style: ["Bird", "wingspan:Int!", "foliage:[Color]"], # Ruby-style: ["BirdType", "wingspan:!types.Int", "foliage:types[Types::ColorType]"], # Mixed ["BirdType", "wingspan:!Int", "foliage:types[Color]"], ] expected_content = <<-RUBY Types::BirdType = GraphQL::ObjectType.define do name "Bird" field :wingspan, !types.Int field :foliage, types[Types::ColorType] end RUBY commands.each do |c| prepare_destination run_generator(c) assert_file "app/graphql/types/bird_type.rb", expected_content end end test "it makes Relay nodes" do run_generator(["Page", "--node"]) assert_file "app/graphql/types/page_type.rb", <<-RUBY Types::PageType = GraphQL::ObjectType.define do name "Page" implements GraphQL::Relay::Node.interface end RUBY end end
Version data entries
9 entries across 9 versions & 1 rubygems