nulogy_graphql_api 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.tool-versions +1 -1
- data/Appraisals +8 -3
- data/CHANGELOG.md +6 -0
- data/gemfiles/{rails_7.gemfile → rails_7_0.gemfile} +2 -2
- data/gemfiles/rails_7_1.gemfile +8 -0
- data/lib/nulogy_graphql_api/rspec/graphql_matchers.rb +56 -27
- data/lib/nulogy_graphql_api/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5df22536e696922579485014185d836121aa098afc60af021145dbd448c4950
|
4
|
+
data.tar.gz: baa28072000c782dea03575731a953de6b2473dfd50d09ee681849c0295bdac2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b4450d8522bb45ed1408acc116e3a817e1962e057d25e617241fce82248c95f8dece65736d0d177141019c9a3683cc7d72e67a6b9b932ae342f9d5240138dc3
|
7
|
+
data.tar.gz: 7632b36bcd21830c6e6a8390b484838bdddbec73cb4dd9bf35e7b1bbb981bd830a410cc6038fc34131e080df19c1f8ba3d7f7b58a97bf834c1938394d3fc9212
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.4
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.
|
1
|
+
ruby 3.2.4
|
data/Appraisals
CHANGED
@@ -2,7 +2,12 @@ appraise "rails-6-1" do
|
|
2
2
|
gem "rails", "6.1.4"
|
3
3
|
end
|
4
4
|
|
5
|
-
appraise "rails-7" do
|
6
|
-
gem "rails", "7.0.
|
7
|
-
gem "sprockets-rails", "3.
|
5
|
+
appraise "rails-7-0" do
|
6
|
+
gem "rails", "7.0.8.6"
|
7
|
+
gem "sprockets-rails", "3.5.2"
|
8
|
+
end
|
9
|
+
|
10
|
+
appraise "rails-7-1" do
|
11
|
+
gem "rails", "7.1.4.2"
|
12
|
+
gem "sprockets-rails", "3.5.2"
|
8
13
|
end
|
data/CHANGELOG.md
CHANGED
@@ -4,43 +4,72 @@ require "rspec/expectations"
|
|
4
4
|
module NulogyGraphqlApi
|
5
5
|
module GraphqlMatchers
|
6
6
|
RSpec::Matchers.define :have_graphql_data do |expected_data|
|
7
|
-
match do |
|
8
|
-
|
9
|
-
|
7
|
+
match do |actual_data|
|
8
|
+
# Allow the expected data to be passed without the root :data key.
|
9
|
+
@actual = actual_data[:data]
|
10
|
+
@expected = expected_data
|
11
|
+
|
12
|
+
deep_match(@expected, @actual)
|
10
13
|
end
|
11
14
|
|
12
|
-
|
13
|
-
<<~MSG
|
14
|
-
expected: #{@expected_response.pretty_inspect}
|
15
|
+
diffable
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
failure_message do
|
18
|
+
"Expected GraphQL data to match (ignoring array ordering) but found differences."
|
18
19
|
end
|
19
|
-
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
expect(actual_response.fetch(:errors, nil)).to contain_exactly(a_hash_including(
|
24
|
-
message: include(message)
|
25
|
-
))
|
21
|
+
failure_message_when_negated do
|
22
|
+
"Expected GraphQL data not to match (ignoring array ordering) but found no differences."
|
26
23
|
end
|
27
|
-
end
|
28
24
|
|
29
|
-
|
30
|
-
|
31
|
-
expect(actual_response).to match({
|
32
|
-
data: {},
|
33
|
-
errors: [{ message: message }.merge(error_extensions)]
|
34
|
-
})
|
25
|
+
def actual
|
26
|
+
@actual
|
35
27
|
end
|
36
|
-
end
|
37
28
|
|
38
|
-
|
39
|
-
|
40
|
-
expect(actual_response.fetch(:errors, nil)).to include(a_hash_including(
|
41
|
-
message: include(message)
|
42
|
-
))
|
29
|
+
def expected
|
30
|
+
@expected
|
43
31
|
end
|
32
|
+
|
33
|
+
def deep_match(expected, actual)
|
34
|
+
case expected
|
35
|
+
when Hash
|
36
|
+
return false unless actual.is_a?(Hash) && expected.keys.sort == actual.keys.sort
|
37
|
+
|
38
|
+
expected.all? { |key, value| deep_match(value, actual[key]) }
|
39
|
+
when Array
|
40
|
+
return false unless actual.is_a?(Array) && expected.size == actual.size
|
41
|
+
|
42
|
+
# Sort both arrays before comparing them element by element.
|
43
|
+
expected.sort_by(&:to_s) == actual.sort_by(&:to_s)
|
44
|
+
else
|
45
|
+
expected == actual
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
RSpec::Matchers.define :have_graphql_error do |message|
|
52
|
+
match do |actual_response|
|
53
|
+
expect(actual_response.fetch(:errors, nil)).to contain_exactly(a_hash_including(
|
54
|
+
message: include(message)
|
55
|
+
))
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
RSpec::Matchers.define :have_network_error do |message, error_extensions = {}|
|
60
|
+
match do |actual_response|
|
61
|
+
expect(actual_response).to match({
|
62
|
+
data: {},
|
63
|
+
errors: [{ message: message }.merge(error_extensions)]
|
64
|
+
})
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
RSpec::Matchers.define :include_graphql_error do |message|
|
69
|
+
match do |actual_response|
|
70
|
+
expect(actual_response.fetch(:errors, nil)).to include(a_hash_including(
|
71
|
+
message: include(message)
|
72
|
+
))
|
44
73
|
end
|
45
74
|
end
|
46
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nulogy_graphql_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Silva
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -224,7 +224,8 @@ files:
|
|
224
224
|
- bin/console
|
225
225
|
- bin/setup
|
226
226
|
- gemfiles/rails_6_1.gemfile
|
227
|
-
- gemfiles/
|
227
|
+
- gemfiles/rails_7_0.gemfile
|
228
|
+
- gemfiles/rails_7_1.gemfile
|
228
229
|
- lib/nulogy_graphql_api.rb
|
229
230
|
- lib/nulogy_graphql_api/error_handling.rb
|
230
231
|
- lib/nulogy_graphql_api/graphql_error.rb
|
@@ -266,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
267
|
- !ruby/object:Gem::Version
|
267
268
|
version: '0'
|
268
269
|
requirements: []
|
269
|
-
rubygems_version: 3.
|
270
|
+
rubygems_version: 3.4.19
|
270
271
|
signing_key:
|
271
272
|
specification_version: 4
|
272
273
|
summary: Standard tooling for building GraphQL apis
|