rspec-graphql_types 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b26a72d1bc61381743a808750c282886f0892fd277eacae8298a2261c782064
4
- data.tar.gz: 4d61e897fecbf31446cfd8c793c5ab3218a920750651be55d8128486a798f0db
3
+ metadata.gz: '09b0fdacbf71641d7232d8aeac7c51556fd1f6eded5cbe40bea812440048c540'
4
+ data.tar.gz: 72409dc88357272392b93812455f5a784c8aa9b94d2a5b45864b58095f2052a6
5
5
  SHA512:
6
- metadata.gz: 11b001aecaad4aa7993a17be7f79e81911d37a75834541214e7bc125b32e39b4e29de98055db230b27c59cb25a8ee36d80c9649661f623af5bc202b5cb65f040
7
- data.tar.gz: b5a8ee65f2303de6bc9cc2a8e7f584bb94bfc0c8cb5f76c40ce4607ef98310d2e6d05fc34c939f5f0d287d4db3e5fc066da086762f409be860a54adaa828c066
6
+ metadata.gz: 95222c8577212d3c0414af9170a4ee27e4e4ccbdddd9669a35ef0320f3527ecacddf3cee7a540e64a95852b1911072c00bbb0c24c0c37ae05fe726a2d7982887
7
+ data.tar.gz: daa82ab33e32698034aa83dc9d44d9033f696ce91239b00624fae970eb3f9daebf570bb6fbd04b98af1b4d80379f9a578cec9aa220453a771f3b97694c8d974f
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  rspec-graphql_types.iml
13
+ vendor
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-graphql_types (1.0.6)
4
+ rspec-graphql_types (1.0.7)
5
5
  activesupport
6
6
  graphql
7
7
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rspec
4
4
  module GraphQLTypes
5
- VERSION = "1.0.6"
5
+ VERSION = "1.0.7"
6
6
  end
7
7
  end
@@ -9,23 +9,43 @@ module Rspec
9
9
  extend ActiveSupport::Concern
10
10
 
11
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 multiplex
17
- nil
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
40
  let(:schema) { ::GraphQL::VERSION.start_with?("1") ? GraphQLTypes.schema_class.new : GraphQLTypes.schema_class }
28
- let(:context) { ::GraphQL::Query::Context.new(query: TestQuery.new, values: context_values, object: nil, schema: schema) }
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
+ }
29
49
  end
30
50
 
31
51
  def graphql_object(type, value)
@@ -74,7 +94,9 @@ module Rspec
74
94
  end
75
95
 
76
96
  def self.schema_class
77
- schemas = ::GraphQL::Schema.subclasses.filter { |schema| !schema.name.start_with?("GraphQL::") }
97
+ schemas = ::GraphQL::Schema.subclasses
98
+ .filter { |schema| !schema.name.start_with?("GraphQL::") }
99
+ .filter { |schema| !schema.name.ends_with?("::SCHEMA") }
78
100
  raise "Could not find valid schema. Please ensure that GraphQL::Schema.subclasses returns a single schema" unless schemas.length == 1
79
101
  schemas.first
80
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.6
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: 2024-10-25 00:00:00.000000000 Z
11
+ date: 2024-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport