rspec-graphql_types 1.0.7 → 1.0.8

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: '09b0fdacbf71641d7232d8aeac7c51556fd1f6eded5cbe40bea812440048c540'
4
- data.tar.gz: 72409dc88357272392b93812455f5a784c8aa9b94d2a5b45864b58095f2052a6
3
+ metadata.gz: 0f6426d6eec64dd893caa0ca56e1dbb57df9b3798a2b6ef3ff2fef9fcb8a1c8f
4
+ data.tar.gz: 2876a66e0b1c2c94c5bee31d291f1787f05d656e3a7725179b08c4a945cd5641
5
5
  SHA512:
6
- metadata.gz: 95222c8577212d3c0414af9170a4ee27e4e4ccbdddd9669a35ef0320f3527ecacddf3cee7a540e64a95852b1911072c00bbb0c24c0c37ae05fe726a2d7982887
7
- data.tar.gz: daa82ab33e32698034aa83dc9d44d9033f696ce91239b00624fae970eb3f9daebf570bb6fbd04b98af1b4d80379f9a578cec9aa220453a771f3b97694c8d974f
6
+ metadata.gz: cfd4fbc4a0e8b9accadd3e4fb8fe520705e01676aaba377dc1b03e56730856f5173982ad223c7ae86e749c44f6da0b6fc9ba1ac6ecbaef25ba7a332c9ab59ec8
7
+ data.tar.gz: 464e751ee2e321e63400dd28b1b2bded5f4bb8b92d14c5e1eababa7c104c6b3f699d70a5fb07883d8a97aa63b10393fff760628d741bb3bcedce73bf381056fa
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-graphql_types (1.0.7)
4
+ rspec-graphql_types (1.0.8)
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.7"
5
+ VERSION = "1.0.8"
6
6
  end
7
7
  end
@@ -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
- schemas = ::GraphQL::Schema.subclasses
98
- .filter { |schema| !schema.name.start_with?("GraphQL::") }
99
- .filter { |schema| !schema.name.ends_with?("::SCHEMA") }
100
- raise "Could not find valid schema. Please ensure that GraphQL::Schema.subclasses returns a single schema" unless schemas.length == 1
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&.ends_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: 1.0.7
4
+ version: 1.0.8
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-30 00:00:00.000000000 Z
11
+ date: 2024-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport