rspec-graphql_response 0.5.0 → 0.6.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/.github/dependabot.yml +14 -0
- data/.github/workflows/test.yml +9 -7
- data/Gemfile.lock +42 -29
- data/README.md +1 -1
- data/RELEASE_NOTES.md +5 -0
- data/docs/execute_graphql.md +1 -1
- data/docs/have_errors.md +7 -7
- data/lib/rspec/graphql_response/helpers/execute_graphql.rb +3 -2
- data/lib/rspec/graphql_response/validators/validation_base.rb +4 -4
- data/lib/rspec/graphql_response/version.rb +1 -1
- data/rspec-graphql_response.gemspec +2 -1
- metadata +5 -22
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d20c225bcb889589108bbd4523938d1788251b035c470c58a558e402e220881
|
|
4
|
+
data.tar.gz: 97e2843002042b969f022194069e169390167d7b5efaedfcfcc7d78a51cabbd6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c832fd141b73dffc2dd85ed9bde975221316cb099e70861e1c050374e63500fa2d2a8a60f032a3a285e078e08d7f49524014a25828d26e4936dd1a3b01ab2d5
|
|
7
|
+
data.tar.gz: f0aa94ec23124e526097dd60713e4d2846293ec98acfa9dc9d6bbddaed76b9baf737c18962fadcac1f354d9de2cf0bb26782e3125f304ba1c9d004d5894d56bd
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Please see the documentation for all configuration options:
|
|
2
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
3
|
+
|
|
4
|
+
version: 2
|
|
5
|
+
updates:
|
|
6
|
+
- package-ecosystem: bundler
|
|
7
|
+
directory: "/"
|
|
8
|
+
schedule: { interval: monthly }
|
|
9
|
+
cooldown: { default-days: 14 }
|
|
10
|
+
- package-ecosystem: github-actions
|
|
11
|
+
directory: "/"
|
|
12
|
+
schedule: { interval: monthly }
|
|
13
|
+
cooldown: { default-days: 14 }
|
|
14
|
+
groups: { github-actions: { patterns: ["*"] } }
|
data/.github/workflows/test.yml
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
name: Test rspec-graphql_response
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches: [ $default-branch ]
|
|
5
|
-
pull_request:
|
|
2
|
+
on: [push, pull_request, workflow_dispatch]
|
|
6
3
|
jobs:
|
|
7
4
|
test:
|
|
8
5
|
runs-on: ubuntu-latest
|
|
6
|
+
strategy:
|
|
7
|
+
fail-fast: false
|
|
8
|
+
matrix:
|
|
9
|
+
ruby: ["3.2", "3.3", "3.4", "4.0"]
|
|
9
10
|
steps:
|
|
10
|
-
- uses: actions/checkout@
|
|
11
|
-
- uses: ruby/setup-ruby@v1
|
|
11
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
12
|
+
- uses: ruby/setup-ruby@14594264cd68ce8a2345dd349bc3d138a4ef85c8 # v1.327.0
|
|
12
13
|
with:
|
|
14
|
+
ruby-version: ${{ matrix.ruby }}
|
|
13
15
|
bundler-cache: true
|
|
14
|
-
- run: bin/rspec
|
|
16
|
+
- run: bin/rspec
|
data/Gemfile.lock
CHANGED
|
@@ -1,52 +1,65 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rspec-graphql_response (0.
|
|
4
|
+
rspec-graphql_response (0.6.0)
|
|
5
5
|
graphql (>= 1.0)
|
|
6
6
|
rspec (>= 3.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
attr_extras (
|
|
12
|
-
|
|
11
|
+
attr_extras (7.1.0)
|
|
12
|
+
base64 (0.3.0)
|
|
13
|
+
byebug (13.0.0)
|
|
14
|
+
reline (>= 0.6.0)
|
|
13
15
|
coderay (1.1.3)
|
|
14
|
-
diff-lcs (1.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
diff-lcs (1.6.2)
|
|
17
|
+
fiber-storage (1.0.1)
|
|
18
|
+
graphql (2.6.11)
|
|
19
|
+
base64
|
|
20
|
+
fiber-storage
|
|
21
|
+
logger
|
|
22
|
+
io-console (0.9.4)
|
|
23
|
+
logger (1.7.0)
|
|
24
|
+
method_source (1.1.0)
|
|
25
|
+
optimist (3.2.1)
|
|
18
26
|
patience_diff (1.2.0)
|
|
19
27
|
optimist (~> 3.0)
|
|
20
|
-
pry (0.
|
|
28
|
+
pry (0.16.0)
|
|
21
29
|
coderay (~> 1.1)
|
|
22
30
|
method_source (~> 1.0)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
rspec-
|
|
33
|
-
|
|
31
|
+
reline (>= 0.6.0)
|
|
32
|
+
pry-byebug (3.12.0)
|
|
33
|
+
byebug (~> 13.0)
|
|
34
|
+
pry (>= 0.13, < 0.17)
|
|
35
|
+
rake (13.4.2)
|
|
36
|
+
reline (0.7.0)
|
|
37
|
+
io-console (~> 0.5)
|
|
38
|
+
rspec (3.13.2)
|
|
39
|
+
rspec-core (~> 3.13.0)
|
|
40
|
+
rspec-expectations (~> 3.13.0)
|
|
41
|
+
rspec-mocks (~> 3.13.0)
|
|
42
|
+
rspec-core (3.13.6)
|
|
43
|
+
rspec-support (~> 3.13.0)
|
|
44
|
+
rspec-expectations (3.13.5)
|
|
34
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
35
|
-
rspec-support (~> 3.
|
|
36
|
-
rspec-mocks (3.
|
|
46
|
+
rspec-support (~> 3.13.0)
|
|
47
|
+
rspec-mocks (3.13.8)
|
|
37
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
38
|
-
rspec-support (~> 3.
|
|
39
|
-
rspec-support (3.
|
|
40
|
-
super_diff (0.
|
|
41
|
-
attr_extras (>= 6.2.4)
|
|
42
|
-
diff-lcs
|
|
43
|
-
patience_diff
|
|
49
|
+
rspec-support (~> 3.13.0)
|
|
50
|
+
rspec-support (3.13.7)
|
|
51
|
+
super_diff (0.19.0)
|
|
52
|
+
attr_extras (>= 6.2.4, < 8)
|
|
53
|
+
diff-lcs (~> 1.5)
|
|
54
|
+
patience_diff (~> 1.2)
|
|
44
55
|
|
|
45
56
|
PLATFORMS
|
|
57
|
+
aarch64-linux
|
|
58
|
+
arm64-darwin
|
|
46
59
|
ruby
|
|
60
|
+
x86_64-linux
|
|
47
61
|
|
|
48
62
|
DEPENDENCIES
|
|
49
|
-
bundler (~> 1.17)
|
|
50
63
|
pry (~> 0.14)
|
|
51
64
|
pry-byebug (~> 3.8)
|
|
52
65
|
rake (>= 12.0)
|
|
@@ -54,4 +67,4 @@ DEPENDENCIES
|
|
|
54
67
|
super_diff (~> 0.6)
|
|
55
68
|
|
|
56
69
|
BUNDLED WITH
|
|
57
|
-
|
|
70
|
+
2.5.22
|
data/README.md
CHANGED
|
@@ -85,7 +85,7 @@ does, and what methods and options are available.
|
|
|
85
85
|
|
|
86
86
|
## How We Got Here
|
|
87
87
|
|
|
88
|
-
Executing a GraphQL call from RSpec is not the most
|
|
88
|
+
Executing a GraphQL call from RSpec is not the most challenging code to write:
|
|
89
89
|
|
|
90
90
|
```ruby
|
|
91
91
|
let(:query) do
|
data/RELEASE_NOTES.md
CHANGED
|
@@ -4,6 +4,11 @@ Release notes for various versions of RSpec::GraphQLResponse
|
|
|
4
4
|
|
|
5
5
|
See [the upgrade guide](/UPGRADE.md) for details on changes between versions and how to upgrade.
|
|
6
6
|
|
|
7
|
+
## v0.6.0 - Ruby 3.2+ required
|
|
8
|
+
|
|
9
|
+
- **Breaking:** Requires Ruby 3.2 or newer.
|
|
10
|
+
- Fixes keyword argument handling for Ruby 3+ (`execute_graphql` and validators) [#12](https://github.com/testdouble/rspec-graphql_response/issues/12).
|
|
11
|
+
|
|
7
12
|
## v0.5.0 - Helper API change
|
|
8
13
|
|
|
9
14
|
- Fully deprecates `operation`.
|
data/docs/execute_graphql.md
CHANGED
data/docs/have_errors.md
CHANGED
|
@@ -18,7 +18,7 @@ Ensure there are no errors in the `response`
|
|
|
18
18
|
|
|
19
19
|
```ruby
|
|
20
20
|
it "should not have errors" do
|
|
21
|
-
expect(response).
|
|
21
|
+
expect(response).not_to have_errors
|
|
22
22
|
end
|
|
23
23
|
```
|
|
24
24
|
|
|
@@ -37,13 +37,13 @@ Ensure the response does not have a specific number of errors.
|
|
|
37
37
|
|
|
38
38
|
```ruby
|
|
39
39
|
it "should not have 2 errors" do
|
|
40
|
-
expect(response).
|
|
40
|
+
expect(response).not_to have_errors(2)
|
|
41
41
|
end
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
### CAUTION: False Positives
|
|
45
45
|
|
|
46
|
-
Using `.to have_errors(count)` and especially using `.
|
|
46
|
+
Using `.to have_errors(count)` and especially using `.not_to have_errors(count)` is
|
|
47
47
|
potentially dangerous!
|
|
48
48
|
|
|
49
49
|
Your test may be ensuring there are not 2 errors, but the underlying code may fail
|
|
@@ -70,13 +70,13 @@ This will ensure the `response["errors"]` contains a "User not found" error mess
|
|
|
70
70
|
|
|
71
71
|
```ruby
|
|
72
72
|
it "does not raise User not found" do
|
|
73
|
-
expect(response).
|
|
73
|
+
expect(response).not_to have_errors.with_messages("User not found")
|
|
74
74
|
end
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
### Fails if Specified Error Found in Array
|
|
78
78
|
|
|
79
|
-
The `.
|
|
79
|
+
The `.not_to` form of `.with_messages` will ensure that none of the error messages
|
|
80
80
|
specified are found withing the response.
|
|
81
81
|
|
|
82
82
|
If, for example the response looks like this:
|
|
@@ -94,7 +94,7 @@ a test like this would fail:
|
|
|
94
94
|
|
|
95
95
|
```ruby
|
|
96
96
|
it "looks for specific errors" do
|
|
97
|
-
expect(response).
|
|
97
|
+
expect(response).not_to have_errors.with_messages("User not found", "Some other errors")
|
|
98
98
|
end
|
|
99
99
|
```
|
|
100
100
|
|
|
@@ -104,7 +104,7 @@ messages would be ignored.
|
|
|
104
104
|
|
|
105
105
|
### CAUTION: False Positives
|
|
106
106
|
|
|
107
|
-
Using `.
|
|
107
|
+
Using `.not_to have_errors.with_messages("Some Message")` is a good way to
|
|
108
108
|
ensure your code is not throwing a specific error message. However, it should
|
|
109
109
|
not be the only expectation against the response. If your code raises any errors
|
|
110
110
|
other than the ones specified, it will result in a passing test but a response
|
|
@@ -10,8 +10,9 @@ RSpec::GraphQLResponse.add_helper :execute_graphql do
|
|
|
10
10
|
operation_context = graphql_context if respond_to? :graphql_context
|
|
11
11
|
operation_context = self.instance_eval(&operation_context) if operation_context.is_a? Proc
|
|
12
12
|
|
|
13
|
-
config.graphql_schema.execute(
|
|
13
|
+
config.graphql_schema.execute(
|
|
14
|
+
operation,
|
|
14
15
|
variables: operation_vars,
|
|
15
16
|
context: operation_context
|
|
16
|
-
|
|
17
|
+
)
|
|
17
18
|
end
|
|
@@ -17,18 +17,18 @@ module RSpec
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def validate(response, *args)
|
|
20
|
+
def validate(response, *args, **kwargs)
|
|
21
21
|
validate_method = self.class.instance_variable_get(:@validate_method)
|
|
22
22
|
|
|
23
23
|
runner = ValidationRunner.new(self)
|
|
24
|
-
runner.instance_exec(response, *args, &validate_method)
|
|
24
|
+
runner.instance_exec(response, *args, **kwargs, &validate_method)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
def validate_negated(response, *args)
|
|
27
|
+
def validate_negated(response, *args, **kwargs)
|
|
28
28
|
validate_negated_method = self.class.instance_variable_get(:@validate_negated_method)
|
|
29
29
|
|
|
30
30
|
runner = ValidationRunner.new(self)
|
|
31
|
-
runner.instance_exec(response, *args, &validate_negated_method)
|
|
31
|
+
runner.instance_exec(response, *args, **kwargs, &validate_negated_method)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def failure_message(type)
|
|
@@ -23,9 +23,10 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
spec.required_ruby_version = ">= 3.2"
|
|
27
|
+
|
|
26
28
|
spec.require_paths = ["lib"]
|
|
27
29
|
|
|
28
|
-
spec.add_development_dependency "bundler", "~> 1.17"
|
|
29
30
|
spec.add_development_dependency "rake", ">= 12.0"
|
|
30
31
|
spec.add_development_dependency "pry", "~> 0.14"
|
|
31
32
|
spec.add_development_dependency "pry-byebug", "~> 3.8"
|
metadata
CHANGED
|
@@ -1,29 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-graphql_response
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- River Lynn Bailey
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: bundler
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.17'
|
|
20
|
-
type: :development
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.17'
|
|
27
12
|
- !ruby/object:Gem::Dependency
|
|
28
13
|
name: rake
|
|
29
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -116,12 +101,12 @@ executables: []
|
|
|
116
101
|
extensions: []
|
|
117
102
|
extra_rdoc_files: []
|
|
118
103
|
files:
|
|
104
|
+
- ".github/dependabot.yml"
|
|
119
105
|
- ".github/workflows/test.yml"
|
|
120
106
|
- ".gitignore"
|
|
121
107
|
- ".gituprc"
|
|
122
108
|
- ".pryrc"
|
|
123
109
|
- ".rspec"
|
|
124
|
-
- ".ruby-version"
|
|
125
110
|
- CODE_OF_CONDUCT.md
|
|
126
111
|
- Gemfile
|
|
127
112
|
- Gemfile.lock
|
|
@@ -169,7 +154,6 @@ homepage: https://github.com/testdouble/rspec-graphql_response
|
|
|
169
154
|
licenses:
|
|
170
155
|
- MIT
|
|
171
156
|
metadata: {}
|
|
172
|
-
post_install_message:
|
|
173
157
|
rdoc_options: []
|
|
174
158
|
require_paths:
|
|
175
159
|
- lib
|
|
@@ -177,15 +161,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
177
161
|
requirements:
|
|
178
162
|
- - ">="
|
|
179
163
|
- !ruby/object:Gem::Version
|
|
180
|
-
version: '
|
|
164
|
+
version: '3.2'
|
|
181
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
166
|
requirements:
|
|
183
167
|
- - ">="
|
|
184
168
|
- !ruby/object:Gem::Version
|
|
185
169
|
version: '0'
|
|
186
170
|
requirements: []
|
|
187
|
-
rubygems_version:
|
|
188
|
-
signing_key:
|
|
171
|
+
rubygems_version: 4.0.21
|
|
189
172
|
specification_version: 4
|
|
190
173
|
summary: Verify ruby-graphql responses with a :graphql spec type
|
|
191
174
|
test_files: []
|
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.6.6
|