graphql 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/graphql/introspection/schema_type.rb +3 -3
  3. data/lib/graphql/language/nodes.rb +1 -1
  4. data/lib/graphql/query.rb +39 -27
  5. data/lib/graphql/query/executor.rb +1 -1
  6. data/lib/graphql/query/variables.rb +21 -28
  7. data/lib/graphql/relay/connection_type.rb +2 -0
  8. data/lib/graphql/relay/relation_connection.rb +8 -2
  9. data/lib/graphql/schema.rb +3 -0
  10. data/lib/graphql/schema/warden.rb +9 -0
  11. data/lib/graphql/static_validation/rules/mutation_root_exists.rb +1 -1
  12. data/lib/graphql/static_validation/rules/subscription_root_exists.rb +1 -1
  13. data/lib/graphql/version.rb +1 -1
  14. data/spec/graphql/analysis/analyze_query_spec.rb +15 -15
  15. data/spec/graphql/analysis/field_usage_spec.rb +1 -1
  16. data/spec/graphql/analysis/max_query_complexity_spec.rb +8 -8
  17. data/spec/graphql/analysis/max_query_depth_spec.rb +7 -7
  18. data/spec/graphql/analysis/query_complexity_spec.rb +2 -2
  19. data/spec/graphql/analysis/query_depth_spec.rb +1 -1
  20. data/spec/graphql/base_type_spec.rb +19 -11
  21. data/spec/graphql/directive_spec.rb +1 -1
  22. data/spec/graphql/enum_type_spec.rb +2 -2
  23. data/spec/graphql/execution/typecast_spec.rb +19 -19
  24. data/spec/graphql/execution_error_spec.rb +1 -1
  25. data/spec/graphql/field_spec.rb +15 -7
  26. data/spec/graphql/id_type_spec.rb +1 -1
  27. data/spec/graphql/input_object_type_spec.rb +16 -16
  28. data/spec/graphql/interface_type_spec.rb +6 -6
  29. data/spec/graphql/internal_representation/rewrite_spec.rb +34 -34
  30. data/spec/graphql/introspection/directive_type_spec.rb +1 -1
  31. data/spec/graphql/introspection/input_value_type_spec.rb +2 -2
  32. data/spec/graphql/introspection/introspection_query_spec.rb +1 -1
  33. data/spec/graphql/introspection/schema_type_spec.rb +2 -2
  34. data/spec/graphql/introspection/type_type_spec.rb +1 -1
  35. data/spec/graphql/language/parser_spec.rb +1 -1
  36. data/spec/graphql/non_null_type_spec.rb +3 -3
  37. data/spec/graphql/object_type_spec.rb +8 -8
  38. data/spec/graphql/query/executor_spec.rb +4 -4
  39. data/spec/graphql/query/variables_spec.rb +20 -4
  40. data/spec/graphql/query_spec.rb +20 -2
  41. data/spec/graphql/relay/connection_type_spec.rb +1 -1
  42. data/spec/graphql/relay/mutation_spec.rb +9 -9
  43. data/spec/graphql/relay/node_spec.rb +8 -8
  44. data/spec/graphql/relay/relation_connection_spec.rb +24 -6
  45. data/spec/graphql/schema/catchall_middleware_spec.rb +3 -3
  46. data/spec/graphql/schema/reduce_types_spec.rb +9 -9
  47. data/spec/graphql/schema/type_expression_spec.rb +3 -3
  48. data/spec/graphql/schema/validation_spec.rb +1 -1
  49. data/spec/graphql/schema/warden_spec.rb +79 -0
  50. data/spec/graphql/schema_spec.rb +2 -2
  51. data/spec/graphql/static_validation/rules/fragments_are_used_spec.rb +1 -1
  52. data/spec/graphql/static_validation/type_stack_spec.rb +2 -2
  53. data/spec/graphql/static_validation/validator_spec.rb +2 -2
  54. data/spec/graphql/union_type_spec.rb +2 -2
  55. data/spec/spec_helper.rb +1 -1
  56. data/spec/support/dummy/data.rb +27 -0
  57. data/spec/support/dummy/schema.rb +369 -0
  58. data/spec/support/star_wars/data.rb +81 -0
  59. data/spec/support/star_wars/schema.rb +250 -0
  60. data/spec/support/static_validation_helpers.rb +2 -2
  61. metadata +10 -10
  62. data/spec/support/dairy_app.rb +0 -369
  63. data/spec/support/dairy_data.rb +0 -26
  64. data/spec/support/star_wars_data.rb +0 -80
  65. data/spec/support/star_wars_schema.rb +0 -242
@@ -3,14 +3,14 @@ require "spec_helper"
3
3
 
4
4
  describe GraphQL::Analysis::MaxQueryDepth do
5
5
  before do
6
- @prev_max_depth = DummySchema.max_depth
6
+ @prev_max_depth = Dummy::Schema.max_depth
7
7
  end
8
8
 
9
9
  after do
10
- DummySchema.max_depth = @prev_max_depth
10
+ Dummy::Schema.max_depth = @prev_max_depth
11
11
  end
12
12
 
13
- let(:result) { DummySchema.execute(query_string) }
13
+ let(:result) { Dummy::Schema.execute(query_string) }
14
14
  let(:query_string) { "
15
15
  {
16
16
  cheese(id: 1) {
@@ -36,7 +36,7 @@ describe GraphQL::Analysis::MaxQueryDepth do
36
36
  end
37
37
 
38
38
  describe "when the query specifies a different max_depth" do
39
- let(:result) { DummySchema.execute(query_string, max_depth: 100) }
39
+ let(:result) { Dummy::Schema.execute(query_string, max_depth: 100) }
40
40
 
41
41
  it "obeys that max_depth" do
42
42
  assert_equal nil, result["errors"]
@@ -45,7 +45,7 @@ describe GraphQL::Analysis::MaxQueryDepth do
45
45
 
46
46
  describe "When the query is not deeper than max_depth" do
47
47
  before do
48
- DummySchema.max_depth = 100
48
+ Dummy::Schema.max_depth = 100
49
49
  end
50
50
 
51
51
  it "doesn't add an error" do
@@ -55,7 +55,7 @@ describe GraphQL::Analysis::MaxQueryDepth do
55
55
 
56
56
  describe "when the max depth isn't set" do
57
57
  before do
58
- DummySchema.max_depth = nil
58
+ Dummy::Schema.max_depth = nil
59
59
  end
60
60
 
61
61
  it "doesn't add an error message" do
@@ -65,7 +65,7 @@ describe GraphQL::Analysis::MaxQueryDepth do
65
65
 
66
66
  describe "when a fragment exceeds max depth" do
67
67
  before do
68
- DummySchema.max_depth = 4
68
+ Dummy::Schema.max_depth = 4
69
69
  end
70
70
 
71
71
  let(:query_string) { "
@@ -6,7 +6,7 @@ describe GraphQL::Analysis::QueryComplexity do
6
6
  let(:query_complexity) { GraphQL::Analysis::QueryComplexity.new { |this_query, complexity| complexities << this_query << complexity } }
7
7
  let(:reduce_result) { GraphQL::Analysis.analyze_query(query, [query_complexity]) }
8
8
  let(:variables) { {} }
9
- let(:query) { GraphQL::Query.new(DummySchema, query_string, variables: variables) }
9
+ let(:query) { GraphQL::Query.new(Dummy::Schema, query_string, variables: variables) }
10
10
 
11
11
  describe "simple queries" do
12
12
  let(:query_string) {%|
@@ -189,7 +189,7 @@ describe GraphQL::Analysis::QueryComplexity do
189
189
  end
190
190
 
191
191
  describe "relay types" do
192
- let(:query) { GraphQL::Query.new(StarWarsSchema, query_string) }
192
+ let(:query) { GraphQL::Query.new(StarWars::Schema, query_string) }
193
193
  let(:query_string) {%|
194
194
  {
195
195
  rebels {
@@ -5,7 +5,7 @@ describe GraphQL::Analysis::QueryDepth do
5
5
  let(:depths) { [] }
6
6
  let(:query_depth) { GraphQL::Analysis::QueryDepth.new { |query, max_depth| depths << query << max_depth } }
7
7
  let(:reduce_result) { GraphQL::Analysis.analyze_query(query, [query_depth]) }
8
- let(:query) { GraphQL::Query.new(DummySchema, query_string, variables: variables) }
8
+ let(:query) { GraphQL::Query.new(Dummy::Schema, query_string, variables: variables) }
9
9
  let(:variables) { {} }
10
10
 
11
11
  describe "simple queries" do
@@ -11,31 +11,39 @@ describe GraphQL::BaseType do
11
11
  end
12
12
 
13
13
  it "can be compared" do
14
+ obj_type = Dummy::MilkType
14
15
  assert_equal(!GraphQL::INT_TYPE, !GraphQL::INT_TYPE)
15
16
  refute_equal(!GraphQL::FLOAT_TYPE, GraphQL::FLOAT_TYPE)
16
17
  assert_equal(
17
- GraphQL::ListType.new(of_type: MilkType),
18
- GraphQL::ListType.new(of_type: MilkType)
18
+ GraphQL::ListType.new(of_type: obj_type),
19
+ GraphQL::ListType.new(of_type: obj_type)
19
20
  )
20
21
  refute_equal(
21
- GraphQL::ListType.new(of_type: MilkType),
22
- GraphQL::ListType.new(of_type: !MilkType)
22
+ GraphQL::ListType.new(of_type: obj_type),
23
+ GraphQL::ListType.new(of_type: !obj_type)
23
24
  )
24
25
  end
25
26
 
26
27
  it "Accepts arbitrary metadata" do
27
- assert_equal ["Cheese"], CheeseType.metadata[:class_names]
28
+ assert_equal ["Cheese"], Dummy::CheeseType.metadata[:class_names]
28
29
  end
29
30
 
30
31
  describe "#dup" do
32
+ let(:obj_type) {
33
+ GraphQL::ObjectType.define do
34
+ name "SomeObject"
35
+ field :id, types.Int
36
+ end
37
+ }
38
+
31
39
  it "resets connection types" do
32
40
  # Make sure the defaults have been calculated
33
- cheese_edge = CheeseType.edge_type
34
- cheese_conn = CheeseType.connection_type
35
- cheese_2 = CheeseType.dup
36
- cheese_2.name = "Cheese2"
37
- refute_equal cheese_edge, cheese_2.edge_type
38
- refute_equal cheese_conn, cheese_2.connection_type
41
+ obj_edge = obj_type.edge_type
42
+ obj_conn = obj_type.connection_type
43
+ obj_2 = obj_type.dup
44
+ obj_2.name = "Cheese2"
45
+ refute_equal obj_edge, obj_2.edge_type
46
+ refute_equal obj_edge, obj_2.connection_type
39
47
  end
40
48
  end
41
49
  end
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
 
4
4
  describe GraphQL::Directive do
5
5
  let(:variables) { {"t" => true, "f" => false} }
6
- let(:result) { DummySchema.execute(query_string, variables: variables) }
6
+ let(:result) { Dummy::Schema.execute(query_string, variables: variables) }
7
7
  describe "on fields" do
8
8
  let(:query_string) { %|query directives($t: Boolean!, $f: Boolean!) {
9
9
  cheese(id: 1) {
@@ -2,7 +2,7 @@
2
2
  require "spec_helper"
3
3
 
4
4
  describe GraphQL::EnumType do
5
- let(:enum) { DairyAnimalEnum }
5
+ let(:enum) { Dummy::DairyAnimalEnum }
6
6
 
7
7
  it "coerces names to underlying values" do
8
8
  assert_equal("YAK", enum.coerce_input("YAK"))
@@ -72,7 +72,7 @@ describe GraphQL::EnumType do
72
72
  end
73
73
 
74
74
  describe "validate_input with bad input" do
75
- let(:result) { DairyAnimalEnum.validate_input("bad enum", PermissiveWarden) }
75
+ let(:result) { enum.validate_input("bad enum", PermissiveWarden) }
76
76
 
77
77
  it "returns an invalid result" do
78
78
  assert(!result.valid?)
@@ -5,7 +5,7 @@ describe GraphQL::Execution::Typecast do
5
5
  let(:milk_value) { MILKS[1] }
6
6
  let(:cheese_value) { CHEESES[1] }
7
7
 
8
- let(:schema) { DummySchema }
8
+ let(:schema) { Dummy::Schema }
9
9
  let(:context) { GraphQL::Query::Context.new(query: OpenStruct.new(schema: schema), values: nil) }
10
10
 
11
11
  def compatible?(*args)
@@ -13,40 +13,40 @@ describe GraphQL::Execution::Typecast do
13
13
  end
14
14
 
15
15
  it "resolves correctly when both types are the same" do
16
- assert compatible?(MilkType, MilkType, context)
16
+ assert compatible?(Dummy::MilkType, Dummy::MilkType, context)
17
17
 
18
- assert !compatible?(MilkType, CheeseType, context)
18
+ assert !compatible?(Dummy::MilkType, Dummy::CheeseType, context)
19
19
  end
20
20
 
21
21
  it "resolves a union type to a matching member" do
22
- assert compatible?(DairyProductUnion, MilkType, context)
23
- assert compatible?(DairyProductUnion, CheeseType, context)
22
+ assert compatible?(Dummy::DairyProductUnion, Dummy::MilkType, context)
23
+ assert compatible?(Dummy::DairyProductUnion, Dummy::CheeseType, context)
24
24
 
25
- assert !compatible?(DairyProductUnion, GraphQL::INT_TYPE, context)
26
- assert !compatible?(DairyProductUnion, HoneyType, context)
25
+ assert !compatible?(Dummy::DairyProductUnion, GraphQL::INT_TYPE, context)
26
+ assert !compatible?(Dummy::DairyProductUnion, Dummy::HoneyType, context)
27
27
  end
28
28
 
29
29
  it "resolves correcty when potential type is UnionType and current type is a member of that union" do
30
- assert compatible?(MilkType, DairyProductUnion, context)
31
- assert compatible?(CheeseType, DairyProductUnion, context)
30
+ assert compatible?(Dummy::MilkType, Dummy::DairyProductUnion, context)
31
+ assert compatible?(Dummy::CheeseType, Dummy::DairyProductUnion, context)
32
32
 
33
- assert !compatible?(QueryType, DairyProductUnion, context)
34
- assert !compatible?(EdibleInterface, DairyProductUnion, context)
33
+ assert !compatible?(Dummy::DairyAppQueryType, Dummy::DairyProductUnion, context)
34
+ assert !compatible?(Dummy::EdibleInterface, Dummy::DairyProductUnion, context)
35
35
  end
36
36
 
37
37
  it "resolves an object type to one of its interfaces" do
38
- assert compatible?(CheeseType, EdibleInterface, context)
39
- assert compatible?(MilkType, EdibleInterface, context)
38
+ assert compatible?(Dummy::CheeseType, Dummy::EdibleInterface, context)
39
+ assert compatible?(Dummy::MilkType, Dummy::EdibleInterface, context)
40
40
 
41
- assert !compatible?(QueryType, EdibleInterface, context)
42
- assert !compatible?(LocalProductInterface, EdibleInterface, context)
41
+ assert !compatible?(Dummy::DairyAppQueryType, Dummy::EdibleInterface, context)
42
+ assert !compatible?(Dummy::LocalProductInterface, Dummy::EdibleInterface, context)
43
43
  end
44
44
 
45
45
  it "resolves an interface to a matching member" do
46
- assert compatible?(EdibleInterface, CheeseType, context)
47
- assert compatible?(EdibleInterface, MilkType, context)
46
+ assert compatible?(Dummy::EdibleInterface, Dummy::CheeseType, context)
47
+ assert compatible?(Dummy::EdibleInterface, Dummy::MilkType, context)
48
48
 
49
- assert !compatible?(EdibleInterface, GraphQL::STRING_TYPE, context)
50
- assert !compatible?(EdibleInterface, DairyProductInputType, context)
49
+ assert !compatible?(Dummy::EdibleInterface, GraphQL::STRING_TYPE, context)
50
+ assert !compatible?(Dummy::EdibleInterface, Dummy::DairyProductInputType, context)
51
51
  end
52
52
  end
@@ -2,7 +2,7 @@
2
2
  require "spec_helper"
3
3
 
4
4
  describe GraphQL::ExecutionError do
5
- let(:result) { DummySchema.execute(query_string) }
5
+ let(:result) { Dummy::Schema.execute(query_string) }
6
6
  describe "when returned from a field" do
7
7
  let(:query_string) {%|
8
8
  {
@@ -1,26 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
  require "spec_helper"
3
3
 
4
+ # Must be top-level so it can be found by string
5
+ FieldSpecReturnType = GraphQL::ObjectType.define do
6
+ name "FieldReturn"
7
+ field :id, types.Int
8
+ field :source, types.String, hash_key: :source
9
+ end
10
+
4
11
  describe GraphQL::Field do
12
+
5
13
  it "accepts a proc as type" do
6
14
  field = GraphQL::Field.define do
7
- type(-> { DairyProductUnion })
15
+ type(-> { FieldSpecReturnType })
8
16
  end
9
17
 
10
- assert_equal(DairyProductUnion, field.type)
18
+ assert_equal(FieldSpecReturnType, field.type)
11
19
  end
12
20
 
13
21
  it "accepts a string as a type" do
14
22
  field = GraphQL::Field.define do
15
- type("DairyProductUnion")
23
+ type("FieldSpecReturnType")
16
24
  end
17
25
 
18
- assert_equal(DairyProductUnion, field.type)
26
+ assert_equal(FieldSpecReturnType, field.type)
19
27
  end
20
28
 
21
29
  it "accepts arguments definition" do
22
30
  number = GraphQL::Argument.define(name: :number, type: -> { GraphQL::INT_TYPE })
23
- field = GraphQL::Field.define(type: DairyProductUnion, arguments: [number])
31
+ field = GraphQL::Field.define(type: FieldSpecReturnType, arguments: [number])
24
32
  assert_equal([number], field.arguments)
25
33
  end
26
34
 
@@ -98,7 +106,7 @@ describe GraphQL::Field do
98
106
  end
99
107
 
100
108
  describe "#hash_key" do
101
- let(:source_field) { MilkType.get_field("source") }
109
+ let(:source_field) { FieldSpecReturnType.get_field("source") }
102
110
  after { source_field.hash_key = :source }
103
111
 
104
112
  it "looks up a value with obj[hash_key]" do
@@ -117,7 +125,7 @@ describe GraphQL::Field do
117
125
 
118
126
  describe "#metadata" do
119
127
  it "accepts user-defined metadata" do
120
- similar_cheese_field = CheeseType.get_field("similarCheese")
128
+ similar_cheese_field = Dummy::CheeseType.get_field("similarCheese")
121
129
  assert_equal [:cheeses, :milks], similar_cheese_field.metadata[:joins]
122
130
  end
123
131
  end
@@ -2,7 +2,7 @@
2
2
  require "spec_helper"
3
3
 
4
4
  describe GraphQL::ID_TYPE do
5
- let(:result) { DummySchema.execute(query_string)}
5
+ let(:result) { Dummy::Schema.execute(query_string)}
6
6
 
7
7
  describe "coercion for int inputs" do
8
8
  let(:query_string) { %|query getMilk { cow: milk(id: 1) { id } }| }
@@ -2,13 +2,13 @@
2
2
  require "spec_helper"
3
3
 
4
4
  describe GraphQL::InputObjectType do
5
- let(:input_object) { DairyProductInputType }
5
+ let(:input_object) { Dummy::DairyProductInputType }
6
6
  it "has a description" do
7
7
  assert(input_object.description)
8
8
  end
9
9
 
10
10
  it "has input fields" do
11
- assert(DairyProductInputType.input_fields["fatContent"])
11
+ assert(input_object.input_fields["fatContent"])
12
12
  end
13
13
 
14
14
  describe "on a type unused by the schema" do
@@ -26,18 +26,18 @@ describe GraphQL::InputObjectType do
26
26
  describe "input validation" do
27
27
  it "Accepts anything that yields key-value pairs to #all?" do
28
28
  values_obj = MinimumInputObject.new({"source" => "COW", "fatContent" => 0.4})
29
- assert DairyProductInputType.valid_input?(values_obj, PermissiveWarden)
29
+ assert input_object.valid_input?(values_obj, PermissiveWarden)
30
30
  end
31
31
 
32
32
  describe "validate_input with non-enumerable input" do
33
33
  it "returns a valid result for MinimumInputObject" do
34
- result = DairyProductInputType.validate_input(MinimumInputObject.new({"source" => "COW", "fatContent" => 0.4}), PermissiveWarden)
34
+ result = input_object.validate_input(MinimumInputObject.new({"source" => "COW", "fatContent" => 0.4}), PermissiveWarden)
35
35
  assert(result.valid?)
36
36
  end
37
37
 
38
38
  it "returns an invalid result for MinimumInvalidInputObject" do
39
39
  invalid_input = MinimumInputObject.new({"source" => "KOALA", "fatContent" => 0.4})
40
- result = DairyProductInputType.validate_input(invalid_input, PermissiveWarden)
40
+ result = input_object.validate_input(invalid_input, PermissiveWarden)
41
41
  assert(!result.valid?)
42
42
  end
43
43
  end
@@ -76,7 +76,7 @@ describe GraphQL::InputObjectType do
76
76
  "fatContent" => 0.4
77
77
  }
78
78
  end
79
- let(:result) { DairyProductInputType.validate_input(input, PermissiveWarden) }
79
+ let(:result) { input_object.validate_input(input, PermissiveWarden) }
80
80
 
81
81
  it "returns a valid result" do
82
82
  assert(result.valid?)
@@ -91,7 +91,7 @@ describe GraphQL::InputObjectType do
91
91
  "fatContent" => 0.4,
92
92
  )
93
93
  end
94
- let(:result) { DairyProductInputType.validate_input(input, PermissiveWarden) }
94
+ let(:result) { input_object.validate_input(input, PermissiveWarden) }
95
95
 
96
96
  it "returns a valid result" do
97
97
  assert(result.valid?)
@@ -100,7 +100,7 @@ describe GraphQL::InputObjectType do
100
100
  end
101
101
 
102
102
  describe "with bad enum and float" do
103
- let(:result) { DairyProductInputType.validate_input({"source" => "KOALA", "fatContent" => "bad_num"}, PermissiveWarden) }
103
+ let(:result) { input_object.validate_input({"source" => "KOALA", "fatContent" => "bad_num"}, PermissiveWarden) }
104
104
 
105
105
  it "returns an invalid result" do
106
106
  assert(!result.valid?)
@@ -113,7 +113,7 @@ describe GraphQL::InputObjectType do
113
113
  end
114
114
 
115
115
  it "has correct problem explanation" do
116
- expected = DairyAnimalEnum.validate_input("KOALA", PermissiveWarden).problems[0]["explanation"]
116
+ expected = Dummy::DairyAnimalEnum.validate_input("KOALA", PermissiveWarden).problems[0]["explanation"]
117
117
 
118
118
  source_problem = result.problems.detect { |p| p["path"] == ["source"] }
119
119
  actual = source_problem["explanation"]
@@ -123,7 +123,7 @@ describe GraphQL::InputObjectType do
123
123
  end
124
124
 
125
125
  describe 'with a string as input' do
126
- let(:result) { DairyProductInputType.validate_input("just a string", PermissiveWarden) }
126
+ let(:result) { input_object.validate_input("just a string", PermissiveWarden) }
127
127
 
128
128
  it "returns an invalid result" do
129
129
  assert(!result.valid?)
@@ -140,7 +140,7 @@ describe GraphQL::InputObjectType do
140
140
  end
141
141
 
142
142
  describe 'with an array as input' do
143
- let(:result) { DairyProductInputType.validate_input(["string array"], PermissiveWarden) }
143
+ let(:result) { input_object.validate_input(["string array"], PermissiveWarden) }
144
144
 
145
145
  it "returns an invalid result" do
146
146
  assert(!result.valid?)
@@ -157,7 +157,7 @@ describe GraphQL::InputObjectType do
157
157
  end
158
158
 
159
159
  describe 'with a int as input' do
160
- let(:result) { DairyProductInputType.validate_input(10, PermissiveWarden) }
160
+ let(:result) { input_object.validate_input(10, PermissiveWarden) }
161
161
 
162
162
  it "returns an invalid result" do
163
163
  assert(!result.valid?)
@@ -174,7 +174,7 @@ describe GraphQL::InputObjectType do
174
174
  end
175
175
 
176
176
  describe "with extra argument" do
177
- let(:result) { DairyProductInputType.validate_input({"source" => "COW", "fatContent" => 0.4, "isDelicious" => false}, PermissiveWarden) }
177
+ let(:result) { input_object.validate_input({"source" => "COW", "fatContent" => 0.4, "isDelicious" => false}, PermissiveWarden) }
178
178
 
179
179
  it "returns an invalid result" do
180
180
  assert(!result.valid?)
@@ -191,7 +191,7 @@ describe GraphQL::InputObjectType do
191
191
  end
192
192
 
193
193
  describe "list with one invalid element" do
194
- let(:list_type) { GraphQL::ListType.new(of_type: DairyProductInputType) }
194
+ let(:list_type) { GraphQL::ListType.new(of_type: Dummy::DairyProductInputType) }
195
195
  let(:result) do
196
196
  list_type.validate_input([
197
197
  { "source" => "COW", "fatContent" => 0.4 },
@@ -213,7 +213,7 @@ describe GraphQL::InputObjectType do
213
213
  end
214
214
 
215
215
  it "has problem with correct explanation" do
216
- expected = DairyAnimalEnum.validate_input("KOALA", PermissiveWarden).problems[0]["explanation"]
216
+ expected = Dummy::DairyAnimalEnum.validate_input("KOALA", PermissiveWarden).problems[0]["explanation"]
217
217
  actual = result.problems[0]["explanation"]
218
218
  assert_equal(expected, actual)
219
219
  end
@@ -278,7 +278,7 @@ describe GraphQL::InputObjectType do
278
278
 
279
279
  describe "when sent into a query" do
280
280
  let(:variables) { {} }
281
- let(:result) { DummySchema.execute(query_string, variables: variables) }
281
+ let(:result) { Dummy::Schema.execute(query_string, variables: variables) }
282
282
 
283
283
  describe "list inputs" do
284
284
  let(:variables) { {"search" => [MinimumInputObject.new({"source" => "COW", "fatContent" => 0.4})]} }
@@ -2,15 +2,15 @@
2
2
  require "spec_helper"
3
3
 
4
4
  describe GraphQL::InterfaceType do
5
- let(:interface) { EdibleInterface }
6
- let(:dummy_query_context) { OpenStruct.new(schema: DummySchema) }
5
+ let(:interface) { Dummy::EdibleInterface }
6
+ let(:dummy_query_context) { OpenStruct.new(schema: Dummy::Schema) }
7
7
 
8
8
  it "has possible types" do
9
- assert_equal([CheeseType, HoneyType, MilkType], DummySchema.possible_types(interface))
9
+ assert_equal([Dummy::CheeseType, Dummy::HoneyType, Dummy::MilkType], Dummy::Schema.possible_types(interface))
10
10
  end
11
11
 
12
12
  describe "query evaluation" do
13
- let(:result) { DummySchema.execute(query_string, variables: {"cheeseId" => 2})}
13
+ let(:result) { Dummy::Schema.execute(query_string, variables: {"cheeseId" => 2})}
14
14
  let(:query_string) {%|
15
15
  query fav {
16
16
  favoriteEdible { fatContent }
@@ -23,7 +23,7 @@ describe GraphQL::InterfaceType do
23
23
  end
24
24
 
25
25
  describe "mergable query evaluation" do
26
- let(:result) { DummySchema.execute(query_string, variables: {"cheeseId" => 2})}
26
+ let(:result) { Dummy::Schema.execute(query_string, variables: {"cheeseId" => 2})}
27
27
  let(:query_string) {%|
28
28
  query fav {
29
29
  favoriteEdible { fatContent }
@@ -47,7 +47,7 @@ describe GraphQL::InterfaceType do
47
47
  }
48
48
  }
49
49
  |}
50
- let(:result) { DummySchema.execute(query_string) }
50
+ let(:result) { Dummy::Schema.execute(query_string) }
51
51
 
52
52
  it "can apply interface fragments to an interface" do
53
53
  expected_result = { "data" => {