Sha256: 52fa5385fe8e594084e804669f9916b05d07c20daa8900859422cda81124d364

Contents?: true

Size: 842 Bytes

Versions: 28

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::Language::Generation do
  describe "#to_query_tring" do
    let(:document) {
      GraphQL.parse('type Query { a: String! }')
    }

    let(:custom_printer_class) {
      Class.new(GraphQL::Language::Printer) {
        def print_field_definition(print_field_definition)
          "<Field Hidden>"
        end
      }
    }

    it "accepts a custom printer" do
      expected = <<-SCHEMA
type Query {
  a: String!
}
      SCHEMA

      assert_equal expected.chomp, GraphQL::Language::Generation.generate(document)
    end

    it "accepts a custom printer" do
      expected = <<-SCHEMA
type Query {
  <Field Hidden>
}
      SCHEMA

      assert_equal expected.chomp, GraphQL::Language::Generation.generate(document, printer: custom_printer_class.new)
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
graphql-1.8.18 spec/graphql/language/generation_spec.rb
graphql-1.9.11 spec/graphql/language/generation_spec.rb
graphql-1.9.10 spec/graphql/language/generation_spec.rb
graphql-1.9.9 spec/graphql/language/generation_spec.rb
graphql-1.9.8 spec/graphql/language/generation_spec.rb
graphql-1.9.7 spec/graphql/language/generation_spec.rb
graphql-1.9.6 spec/graphql/language/generation_spec.rb
graphql-1.9.5 spec/graphql/language/generation_spec.rb
graphql-1.9.4 spec/graphql/language/generation_spec.rb
graphql-1.9.3 spec/graphql/language/generation_spec.rb
graphql-1.9.2 spec/graphql/language/generation_spec.rb
graphql-1.8.17 spec/graphql/language/generation_spec.rb
graphql-1.8.16 spec/graphql/language/generation_spec.rb
graphql-1.9.1 spec/graphql/language/generation_spec.rb
graphql-1.9.0 spec/graphql/language/generation_spec.rb
graphql-1.8.15 spec/graphql/language/generation_spec.rb
graphql-1.9.0.pre4 spec/graphql/language/generation_spec.rb
graphql-1.8.14 spec/graphql/language/generation_spec.rb
graphql-1.9.0.pre3 spec/graphql/language/generation_spec.rb
graphql-1.9.0.pre2 spec/graphql/language/generation_spec.rb