rspec-graphql_types 1.0.7 → 2.0.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -9
- data/lib/rspec/graphql_types/version.rb +1 -1
- data/lib/rspec/graphql_types.rb +26 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7626ad08971829c0d30d9cb3da3d37bb1af837665d6f8a85e62839fdbf9244c
|
4
|
+
data.tar.gz: ba82a2fafe16bb7b4a34490a2dd7d4a18e30c5cba0a14b7182b45f2b59eef64f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1afe0021cd87e55334f416c135710ce862f66b34c32d60b24dd01f27f52043b7e7ae633ee6119115c96e7f68fd7c137cf062ec6957e353f85b09c0f1170c51b2
|
7
|
+
data.tar.gz: 712531d1948fc3d8ce8cc5807936f2455fec25343a5e56d933e0a934c40cb8e55510edefdf7a5d489af446a1beeece6af1d8a681f36785874ce88d3ddd3fd7d8
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-graphql_types (
|
4
|
+
rspec-graphql_types (2.0.0)
|
5
5
|
activesupport
|
6
6
|
graphql
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (7.2.
|
11
|
+
activesupport (7.2.2)
|
12
12
|
base64
|
13
|
+
benchmark (>= 0.3)
|
13
14
|
bigdecimal
|
14
15
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
15
16
|
connection_pool (>= 2.2.5)
|
@@ -20,19 +21,20 @@ GEM
|
|
20
21
|
securerandom (>= 0.3)
|
21
22
|
tzinfo (~> 2.0, >= 2.0.5)
|
22
23
|
base64 (0.2.0)
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
benchmark (0.4.0)
|
25
|
+
bigdecimal (3.1.9)
|
26
|
+
concurrent-ruby (1.3.5)
|
27
|
+
connection_pool (2.5.0)
|
26
28
|
diff-lcs (1.4.4)
|
27
29
|
drb (2.2.1)
|
28
30
|
fiber-storage (1.0.0)
|
29
31
|
graphql (2.3.19)
|
30
32
|
base64
|
31
33
|
fiber-storage
|
32
|
-
i18n (1.14.
|
34
|
+
i18n (1.14.7)
|
33
35
|
concurrent-ruby (~> 1.0)
|
34
|
-
logger (1.6.
|
35
|
-
minitest (5.25.
|
36
|
+
logger (1.6.5)
|
37
|
+
minitest (5.25.4)
|
36
38
|
rake (13.0.3)
|
37
39
|
rspec (3.10.0)
|
38
40
|
rspec-core (~> 3.10.0)
|
@@ -47,7 +49,7 @@ GEM
|
|
47
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
50
|
rspec-support (~> 3.10.0)
|
49
51
|
rspec-support (3.10.2)
|
50
|
-
securerandom (0.
|
52
|
+
securerandom (0.4.1)
|
51
53
|
tzinfo (2.0.6)
|
52
54
|
concurrent-ruby (~> 1.0)
|
53
55
|
|
data/lib/rspec/graphql_types.rb
CHANGED
@@ -8,11 +8,11 @@ module Rspec
|
|
8
8
|
module GraphQLTypes
|
9
9
|
extend ActiveSupport::Concern
|
10
10
|
|
11
|
-
class TestQuery < ::GraphQL::Query
|
11
|
+
class TestQuery < ::GraphQL::Query
|
12
12
|
attr_reader :context, :schema, :multiplex
|
13
13
|
|
14
14
|
def initialize(context:, schema:)
|
15
|
-
super()
|
15
|
+
super(schema, context: context)
|
16
16
|
@context = context
|
17
17
|
@schema = schema
|
18
18
|
@multiplex = false
|
@@ -27,7 +27,7 @@ module Rspec
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def warden
|
30
|
-
@warden ||= ::GraphQL::
|
30
|
+
@warden ||= ::GraphQL::Schema::Warden.new(
|
31
31
|
::GraphQL::Filter.new,
|
32
32
|
context: context,
|
33
33
|
schema: schema
|
@@ -40,7 +40,7 @@ module Rspec
|
|
40
40
|
let(:schema) { ::GraphQL::VERSION.start_with?("1") ? GraphQLTypes.schema_class.new : GraphQLTypes.schema_class }
|
41
41
|
let(:context) {
|
42
42
|
::GraphQL::Query::Context.new(
|
43
|
-
query: TestQuery.new(context:
|
43
|
+
query: TestQuery.new(context: GraphQL::Query::Context.new(query: nil, values: {}, object: nil, schema: schema), schema: schema),
|
44
44
|
values: context_values,
|
45
45
|
object: nil,
|
46
46
|
schema: schema
|
@@ -48,6 +48,18 @@ module Rspec
|
|
48
48
|
}
|
49
49
|
end
|
50
50
|
|
51
|
+
class Configuration
|
52
|
+
attr_accessor :graphql_schema
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.configuration
|
56
|
+
@configuration ||= Configuration.new
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.configure
|
60
|
+
yield configuration
|
61
|
+
end
|
62
|
+
|
51
63
|
def graphql_object(type, value)
|
52
64
|
if value.nil?
|
53
65
|
raise "Received a nil value for #{type}" if type.non_null?
|
@@ -94,11 +106,17 @@ module Rspec
|
|
94
106
|
end
|
95
107
|
|
96
108
|
def self.schema_class
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
raise "Could not find valid schema.
|
109
|
+
return configuration.graphql_schema if configuration.graphql_schema
|
110
|
+
|
111
|
+
schemas = find_graphql_schema
|
112
|
+
raise "Could not find valid schema. Found: #{schemas.join(", ")} Use Rspec::GraphQLTypes.configure to specify the correct schema" unless schemas.length == 1
|
101
113
|
schemas.first
|
102
114
|
end
|
115
|
+
|
116
|
+
def self.find_graphql_schema
|
117
|
+
::GraphQL::Schema.subclasses
|
118
|
+
.filter { |schema| !schema.name&.start_with?("GraphQL::") }
|
119
|
+
.filter { |schema| !schema.name&.end_with?("::SCHEMA") }
|
120
|
+
end
|
103
121
|
end
|
104
122
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-graphql_types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tejas Dinkar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|