rspec-graphql_types 1.0.5 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +25 -11
- data/lib/rspec/graphql_types/version.rb +1 -1
- data/lib/rspec/graphql_types.rb +29 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09b0fdacbf71641d7232d8aeac7c51556fd1f6eded5cbe40bea812440048c540'
|
4
|
+
data.tar.gz: 72409dc88357272392b93812455f5a784c8aa9b94d2a5b45864b58095f2052a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95222c8577212d3c0414af9170a4ee27e4e4ccbdddd9669a35ef0320f3527ecacddf3cee7a540e64a95852b1911072c00bbb0c24c0c37ae05fe726a2d7982887
|
7
|
+
data.tar.gz: daa82ab33e32698034aa83dc9d44d9033f696ce91239b00624fae970eb3f9daebf570bb6fbd04b98af1b4d80379f9a578cec9aa220453a771f3b97694c8d974f
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,25 +1,38 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-graphql_types (1.0.
|
4
|
+
rspec-graphql_types (1.0.7)
|
5
5
|
activesupport
|
6
6
|
graphql
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (
|
12
|
-
|
11
|
+
activesupport (7.2.1.2)
|
12
|
+
base64
|
13
|
+
bigdecimal
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
15
|
+
connection_pool (>= 2.2.5)
|
16
|
+
drb
|
13
17
|
i18n (>= 1.6, < 2)
|
18
|
+
logger (>= 1.4.2)
|
14
19
|
minitest (>= 5.1)
|
15
|
-
|
16
|
-
|
17
|
-
|
20
|
+
securerandom (>= 0.3)
|
21
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
22
|
+
base64 (0.2.0)
|
23
|
+
bigdecimal (3.1.8)
|
24
|
+
concurrent-ruby (1.3.4)
|
25
|
+
connection_pool (2.4.1)
|
18
26
|
diff-lcs (1.4.4)
|
19
|
-
|
20
|
-
|
27
|
+
drb (2.2.1)
|
28
|
+
fiber-storage (1.0.0)
|
29
|
+
graphql (2.3.19)
|
30
|
+
base64
|
31
|
+
fiber-storage
|
32
|
+
i18n (1.14.6)
|
21
33
|
concurrent-ruby (~> 1.0)
|
22
|
-
|
34
|
+
logger (1.6.1)
|
35
|
+
minitest (5.25.1)
|
23
36
|
rake (13.0.3)
|
24
37
|
rspec (3.10.0)
|
25
38
|
rspec-core (~> 3.10.0)
|
@@ -34,12 +47,13 @@ GEM
|
|
34
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
48
|
rspec-support (~> 3.10.0)
|
36
49
|
rspec-support (3.10.2)
|
37
|
-
|
50
|
+
securerandom (0.3.1)
|
51
|
+
tzinfo (2.0.6)
|
38
52
|
concurrent-ruby (~> 1.0)
|
39
|
-
zeitwerk (2.4.2)
|
40
53
|
|
41
54
|
PLATFORMS
|
42
55
|
arm64-darwin-20
|
56
|
+
arm64-darwin-23
|
43
57
|
x86_64-darwin-20
|
44
58
|
|
45
59
|
DEPENDENCIES
|
data/lib/rspec/graphql_types.rb
CHANGED
@@ -8,23 +8,44 @@ module Rspec
|
|
8
8
|
module GraphQLTypes
|
9
9
|
extend ActiveSupport::Concern
|
10
10
|
|
11
|
-
class TestQuery < GraphQL::Query::NullContext::NullQuery
|
11
|
+
class TestQuery < ::GraphQL::Query::NullContext::NullQuery
|
12
|
+
attr_reader :context, :schema, :multiplex
|
13
|
+
|
14
|
+
def initialize(context:, schema:)
|
15
|
+
super()
|
16
|
+
@context = context
|
17
|
+
@schema = schema
|
18
|
+
@multiplex = false
|
19
|
+
end
|
20
|
+
|
12
21
|
def trace(_key, _data)
|
13
22
|
yield
|
14
23
|
end
|
15
24
|
|
16
|
-
def
|
17
|
-
|
25
|
+
def handle_or_reraise(err)
|
26
|
+
schema.handle_or_reraise(context, err)
|
18
27
|
end
|
19
28
|
|
20
29
|
def warden
|
21
|
-
@warden
|
30
|
+
@warden ||= ::GraphQL::Query::NullContext::NullWarden.new(
|
31
|
+
::GraphQL::Filter.new,
|
32
|
+
context: context,
|
33
|
+
schema: schema
|
34
|
+
)
|
22
35
|
end
|
23
36
|
end
|
24
37
|
|
25
38
|
included do
|
26
39
|
let(:context_values) { nil }
|
27
|
-
let(:
|
40
|
+
let(:schema) { ::GraphQL::VERSION.start_with?("1") ? GraphQLTypes.schema_class.new : GraphQLTypes.schema_class }
|
41
|
+
let(:context) {
|
42
|
+
::GraphQL::Query::Context.new(
|
43
|
+
query: TestQuery.new(context: self, schema: schema),
|
44
|
+
values: context_values,
|
45
|
+
object: nil,
|
46
|
+
schema: schema
|
47
|
+
)
|
48
|
+
}
|
28
49
|
end
|
29
50
|
|
30
51
|
def graphql_object(type, value)
|
@@ -73,7 +94,9 @@ module Rspec
|
|
73
94
|
end
|
74
95
|
|
75
96
|
def self.schema_class
|
76
|
-
schemas = GraphQL::Schema.subclasses
|
97
|
+
schemas = ::GraphQL::Schema.subclasses
|
98
|
+
.filter { |schema| !schema.name.start_with?("GraphQL::") }
|
99
|
+
.filter { |schema| !schema.name.ends_with?("::SCHEMA") }
|
77
100
|
raise "Could not find valid schema. Please ensure that GraphQL::Schema.subclasses returns a single schema" unless schemas.length == 1
|
78
101
|
schemas.first
|
79
102
|
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: 1.0.
|
4
|
+
version: 1.0.7
|
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: 2024-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
|
-
rubygems_version: 3.
|
85
|
+
rubygems_version: 3.3.26
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Test out types in ruby graphql
|