|
2 | 2 | require "spec_helper"
|
3 | 3 |
|
4 | 4 | describe GraphQL::Introspection::TypeByNameField do
|
5 |
| - describe "after instrumentation" do |
6 |
| - # Just make sure it returns a new object, not the original field |
7 |
| - class DupInstrumenter |
8 |
| - def self.instrument(t, f) |
9 |
| - f.redefine { |
10 |
| - resolve ->(o, a, c) { :no_op } |
11 |
| - } |
12 |
| - end |
| 5 | + describe "after instrumentation" do |
| 6 | + # Just make sure it returns a new object, not the original field |
| 7 | + class DupInstrumenter |
| 8 | + def self.instrument(t, f) |
| 9 | + f.redefine { |
| 10 | + resolve ->(o, a, c) { :no_op } |
| 11 | + } |
13 | 12 | end
|
| 13 | + end |
14 | 14 |
|
15 |
| - class ArgAnalyzer |
16 |
| - def call(_, _, node) |
17 |
| - if node.ast_node.is_a?(GraphQL::Language::Nodes::Field) |
18 |
| - node.arguments |
19 |
| - end |
| 15 | + class ArgAnalyzer |
| 16 | + def call(_, _, node) |
| 17 | + if node.ast_node.is_a?(GraphQL::Language::Nodes::Field) |
| 18 | + node.arguments |
20 | 19 | end
|
21 | 20 | end
|
| 21 | + end |
22 | 22 |
|
23 |
| - let(:instrumented_schema) { |
24 |
| - # This was probably assigned earlier in the test suite, but to simulate an application, clear it. |
25 |
| - GraphQL::Introspection::TypeByNameField.arguments_class = nil |
| 23 | + let(:instrumented_schema) { |
| 24 | + # This was probably assigned earlier in the test suite, but to simulate an application, clear it. |
| 25 | + GraphQL::Introspection::TypeByNameField.arguments_class = nil |
26 | 26 |
|
27 |
| - Dummy::Schema.redefine { |
28 |
| - instrument(:field, DupInstrumenter) |
29 |
| - query_analyzer(ArgAnalyzer.new) |
30 |
| - } |
| 27 | + Dummy::Schema.redefine { |
| 28 | + instrument(:field, DupInstrumenter) |
| 29 | + query_analyzer(ArgAnalyzer.new) |
31 | 30 | }
|
| 31 | + } |
32 | 32 |
|
33 |
| - it "still works with __type" do |
34 |
| - res = instrumented_schema.execute("{ __type(name: \"X\") { name } }") |
35 |
| - assert_equal({"data"=>{"__type"=>nil}}, res) |
36 |
| - end |
| 33 | + it "still works with __type" do |
| 34 | + res = instrumented_schema.execute("{ __type(name: \"X\") { name } }") |
| 35 | + assert_equal({"data"=>{"__type"=>nil}}, res) |
37 | 36 | end
|
38 |
| - |
| 37 | + end |
39 | 38 | end
|
0 commit comments