rspec-json_api 1.0.2 → 1.1.1
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 -0
- data/Gemfile +0 -2
- data/Gemfile.lock +97 -80
- data/README.md +1 -1
- data/lib/extentions/hash.rb +1 -1
- data/lib/rspec/json_api/compare_hash.rb +12 -8
- data/lib/rspec/json_api/version.rb +1 -1
- data/rspec-json_api.gemspec +3 -3
- metadata +4 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f40d1a16f0eff4c046c4598ace80041df867575e52065a1b1dd298ec9cf98d6
|
4
|
+
data.tar.gz: 8aae365879c35374679dac663a490bdb5018a3646f8b30e64836700220aed5fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a5b5fe0e572b4e1424ebd7e32d1d0178046ee111e1c9e69f09fbae69eda8c273fd98498570c6ab7a4b58c12b214d11bfd8eec701e1b4502770826cd2c1cf724
|
7
|
+
data.tar.gz: 82afdf75029cd84a8ae8bd84335a4ef48e5dab5db0682018a79a2f799991fcc1af8c069fd01abd3905fe4ee468e46d28cbc615e0cf4d5c8e80133e10abd309d7
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.2.2
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,68 +1,68 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-json_api (1.
|
5
|
-
activesupport (
|
6
|
-
rails (
|
7
|
-
rspec-rails (
|
4
|
+
rspec-json_api (1.1.0)
|
5
|
+
activesupport (>= 6.1.4.1)
|
6
|
+
rails (>= 6.1.4.1)
|
7
|
+
rspec-rails (>= 5.0.2)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actioncable (6.1.4.
|
13
|
-
actionpack (= 6.1.4.
|
14
|
-
activesupport (= 6.1.4.
|
12
|
+
actioncable (6.1.4.4)
|
13
|
+
actionpack (= 6.1.4.4)
|
14
|
+
activesupport (= 6.1.4.4)
|
15
15
|
nio4r (~> 2.0)
|
16
16
|
websocket-driver (>= 0.6.1)
|
17
|
-
actionmailbox (6.1.4.
|
18
|
-
actionpack (= 6.1.4.
|
19
|
-
activejob (= 6.1.4.
|
20
|
-
activerecord (= 6.1.4.
|
21
|
-
activestorage (= 6.1.4.
|
22
|
-
activesupport (= 6.1.4.
|
17
|
+
actionmailbox (6.1.4.4)
|
18
|
+
actionpack (= 6.1.4.4)
|
19
|
+
activejob (= 6.1.4.4)
|
20
|
+
activerecord (= 6.1.4.4)
|
21
|
+
activestorage (= 6.1.4.4)
|
22
|
+
activesupport (= 6.1.4.4)
|
23
23
|
mail (>= 2.7.1)
|
24
|
-
actionmailer (6.1.4.
|
25
|
-
actionpack (= 6.1.4.
|
26
|
-
actionview (= 6.1.4.
|
27
|
-
activejob (= 6.1.4.
|
28
|
-
activesupport (= 6.1.4.
|
24
|
+
actionmailer (6.1.4.4)
|
25
|
+
actionpack (= 6.1.4.4)
|
26
|
+
actionview (= 6.1.4.4)
|
27
|
+
activejob (= 6.1.4.4)
|
28
|
+
activesupport (= 6.1.4.4)
|
29
29
|
mail (~> 2.5, >= 2.5.4)
|
30
30
|
rails-dom-testing (~> 2.0)
|
31
|
-
actionpack (6.1.4.
|
32
|
-
actionview (= 6.1.4.
|
33
|
-
activesupport (= 6.1.4.
|
31
|
+
actionpack (6.1.4.4)
|
32
|
+
actionview (= 6.1.4.4)
|
33
|
+
activesupport (= 6.1.4.4)
|
34
34
|
rack (~> 2.0, >= 2.0.9)
|
35
35
|
rack-test (>= 0.6.3)
|
36
36
|
rails-dom-testing (~> 2.0)
|
37
37
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
38
|
-
actiontext (6.1.4.
|
39
|
-
actionpack (= 6.1.4.
|
40
|
-
activerecord (= 6.1.4.
|
41
|
-
activestorage (= 6.1.4.
|
42
|
-
activesupport (= 6.1.4.
|
38
|
+
actiontext (6.1.4.4)
|
39
|
+
actionpack (= 6.1.4.4)
|
40
|
+
activerecord (= 6.1.4.4)
|
41
|
+
activestorage (= 6.1.4.4)
|
42
|
+
activesupport (= 6.1.4.4)
|
43
43
|
nokogiri (>= 1.8.5)
|
44
|
-
actionview (6.1.4.
|
45
|
-
activesupport (= 6.1.4.
|
44
|
+
actionview (6.1.4.4)
|
45
|
+
activesupport (= 6.1.4.4)
|
46
46
|
builder (~> 3.1)
|
47
47
|
erubi (~> 1.4)
|
48
48
|
rails-dom-testing (~> 2.0)
|
49
49
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
50
|
-
activejob (6.1.4.
|
51
|
-
activesupport (= 6.1.4.
|
50
|
+
activejob (6.1.4.4)
|
51
|
+
activesupport (= 6.1.4.4)
|
52
52
|
globalid (>= 0.3.6)
|
53
|
-
activemodel (6.1.4.
|
54
|
-
activesupport (= 6.1.4.
|
55
|
-
activerecord (6.1.4.
|
56
|
-
activemodel (= 6.1.4.
|
57
|
-
activesupport (= 6.1.4.
|
58
|
-
activestorage (6.1.4.
|
59
|
-
actionpack (= 6.1.4.
|
60
|
-
activejob (= 6.1.4.
|
61
|
-
activerecord (= 6.1.4.
|
62
|
-
activesupport (= 6.1.4.
|
53
|
+
activemodel (6.1.4.4)
|
54
|
+
activesupport (= 6.1.4.4)
|
55
|
+
activerecord (6.1.4.4)
|
56
|
+
activemodel (= 6.1.4.4)
|
57
|
+
activesupport (= 6.1.4.4)
|
58
|
+
activestorage (6.1.4.4)
|
59
|
+
actionpack (= 6.1.4.4)
|
60
|
+
activejob (= 6.1.4.4)
|
61
|
+
activerecord (= 6.1.4.4)
|
62
|
+
activesupport (= 6.1.4.4)
|
63
63
|
marcel (~> 1.0.0)
|
64
64
|
mini_mime (>= 1.1.0)
|
65
|
-
activesupport (6.1.4.
|
65
|
+
activesupport (6.1.4.4)
|
66
66
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
67
67
|
i18n (>= 1.6, < 2)
|
68
68
|
minitest (>= 5.1)
|
@@ -71,64 +71,79 @@ GEM
|
|
71
71
|
builder (3.2.4)
|
72
72
|
concurrent-ruby (1.1.9)
|
73
73
|
crass (1.0.6)
|
74
|
-
|
74
|
+
date (3.3.4)
|
75
|
+
diff-lcs (1.5.0)
|
75
76
|
erubi (1.10.0)
|
76
|
-
globalid (
|
77
|
-
activesupport (>=
|
78
|
-
i18n (1.
|
77
|
+
globalid (1.2.1)
|
78
|
+
activesupport (>= 6.1)
|
79
|
+
i18n (1.9.1)
|
79
80
|
concurrent-ruby (~> 1.0)
|
80
|
-
loofah (2.
|
81
|
+
loofah (2.13.0)
|
81
82
|
crass (~> 1.0.2)
|
82
83
|
nokogiri (>= 1.5.9)
|
83
|
-
mail (2.
|
84
|
+
mail (2.8.1)
|
84
85
|
mini_mime (>= 0.1.1)
|
86
|
+
net-imap
|
87
|
+
net-pop
|
88
|
+
net-smtp
|
85
89
|
marcel (1.0.2)
|
86
90
|
method_source (1.0.0)
|
87
|
-
mini_mime (1.1.
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
+
mini_mime (1.1.5)
|
92
|
+
mini_portile2 (2.7.1)
|
93
|
+
minitest (5.15.0)
|
94
|
+
net-imap (0.4.4)
|
95
|
+
date
|
96
|
+
net-protocol
|
97
|
+
net-pop (0.1.2)
|
98
|
+
net-protocol
|
99
|
+
net-protocol (0.2.2)
|
100
|
+
timeout
|
101
|
+
net-smtp (0.4.0)
|
102
|
+
net-protocol
|
103
|
+
nio4r (2.5.9)
|
104
|
+
nokogiri (1.13.1)
|
105
|
+
mini_portile2 (~> 2.7.0)
|
91
106
|
racc (~> 1.4)
|
92
|
-
racc (1.
|
107
|
+
racc (1.6.0)
|
93
108
|
rack (2.2.3)
|
94
109
|
rack-test (1.1.0)
|
95
110
|
rack (>= 1.0, < 3)
|
96
|
-
rails (6.1.4.
|
97
|
-
actioncable (= 6.1.4.
|
98
|
-
actionmailbox (= 6.1.4.
|
99
|
-
actionmailer (= 6.1.4.
|
100
|
-
actionpack (= 6.1.4.
|
101
|
-
actiontext (= 6.1.4.
|
102
|
-
actionview (= 6.1.4.
|
103
|
-
activejob (= 6.1.4.
|
104
|
-
activemodel (= 6.1.4.
|
105
|
-
activerecord (= 6.1.4.
|
106
|
-
activestorage (= 6.1.4.
|
107
|
-
activesupport (= 6.1.4.
|
111
|
+
rails (6.1.4.4)
|
112
|
+
actioncable (= 6.1.4.4)
|
113
|
+
actionmailbox (= 6.1.4.4)
|
114
|
+
actionmailer (= 6.1.4.4)
|
115
|
+
actionpack (= 6.1.4.4)
|
116
|
+
actiontext (= 6.1.4.4)
|
117
|
+
actionview (= 6.1.4.4)
|
118
|
+
activejob (= 6.1.4.4)
|
119
|
+
activemodel (= 6.1.4.4)
|
120
|
+
activerecord (= 6.1.4.4)
|
121
|
+
activestorage (= 6.1.4.4)
|
122
|
+
activesupport (= 6.1.4.4)
|
108
123
|
bundler (>= 1.15.0)
|
109
|
-
railties (= 6.1.4.
|
124
|
+
railties (= 6.1.4.4)
|
110
125
|
sprockets-rails (>= 2.0.0)
|
111
126
|
rails-dom-testing (2.0.3)
|
112
127
|
activesupport (>= 4.2.0)
|
113
128
|
nokogiri (>= 1.6)
|
114
129
|
rails-html-sanitizer (1.4.2)
|
115
130
|
loofah (~> 2.3)
|
116
|
-
railties (6.1.4.
|
117
|
-
actionpack (= 6.1.4.
|
118
|
-
activesupport (= 6.1.4.
|
131
|
+
railties (6.1.4.4)
|
132
|
+
actionpack (= 6.1.4.4)
|
133
|
+
activesupport (= 6.1.4.4)
|
119
134
|
method_source
|
120
135
|
rake (>= 0.13)
|
121
136
|
thor (~> 1.0)
|
122
137
|
rake (13.0.6)
|
123
|
-
rspec-core (3.10.
|
138
|
+
rspec-core (3.10.2)
|
124
139
|
rspec-support (~> 3.10.0)
|
125
|
-
rspec-expectations (3.10.
|
140
|
+
rspec-expectations (3.10.2)
|
126
141
|
diff-lcs (>= 1.2.0, < 2.0)
|
127
142
|
rspec-support (~> 3.10.0)
|
128
|
-
rspec-mocks (3.10.
|
143
|
+
rspec-mocks (3.10.3)
|
129
144
|
diff-lcs (>= 1.2.0, < 2.0)
|
130
145
|
rspec-support (~> 3.10.0)
|
131
|
-
rspec-rails (5.0
|
146
|
+
rspec-rails (5.1.0)
|
132
147
|
actionpack (>= 5.2)
|
133
148
|
activesupport (>= 5.2)
|
134
149
|
railties (>= 5.2)
|
@@ -136,23 +151,25 @@ GEM
|
|
136
151
|
rspec-expectations (~> 3.10)
|
137
152
|
rspec-mocks (~> 3.10)
|
138
153
|
rspec-support (~> 3.10)
|
139
|
-
rspec-support (3.10.
|
140
|
-
sprockets (4.
|
154
|
+
rspec-support (3.10.3)
|
155
|
+
sprockets (4.1.1)
|
141
156
|
concurrent-ruby (~> 1.0)
|
142
157
|
rack (> 1, < 3)
|
143
|
-
sprockets-rails (3.
|
144
|
-
actionpack (>=
|
145
|
-
activesupport (>=
|
158
|
+
sprockets-rails (3.4.2)
|
159
|
+
actionpack (>= 5.2)
|
160
|
+
activesupport (>= 5.2)
|
146
161
|
sprockets (>= 3.0.0)
|
147
|
-
thor (1.1
|
162
|
+
thor (1.2.1)
|
163
|
+
timeout (0.4.1)
|
148
164
|
tzinfo (2.0.4)
|
149
165
|
concurrent-ruby (~> 1.0)
|
150
|
-
websocket-driver (0.7.
|
166
|
+
websocket-driver (0.7.6)
|
151
167
|
websocket-extensions (>= 0.1.0)
|
152
168
|
websocket-extensions (0.1.5)
|
153
|
-
zeitwerk (2.4
|
169
|
+
zeitwerk (2.5.4)
|
154
170
|
|
155
171
|
PLATFORMS
|
172
|
+
arm64-darwin-22
|
156
173
|
x86_64-darwin-20
|
157
174
|
|
158
175
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Generate directory tree:
|
|
24
24
|
|
25
25
|
rails generate rspec:json_api:install
|
26
26
|
|
27
|
-
Require gem assets in your `
|
27
|
+
Require gem assets in your `rails_helper.rb`
|
28
28
|
```ruby
|
29
29
|
Dir[File.join(__dir__, 'rspec', 'json_api', 'types', '*.rb')].each { |file| require file }
|
30
30
|
Dir[File.join(__dir__, 'rspec', 'json_api', 'interfaces', '*.rb')].each { |file| require file }
|
data/lib/extentions/hash.rb
CHANGED
@@ -10,9 +10,15 @@ module RSpec
|
|
10
10
|
def compare(actual, expected)
|
11
11
|
return false if actual.blank? && expected.present?
|
12
12
|
|
13
|
-
|
13
|
+
keys = expected.deep_key_paths | actual.deep_key_paths
|
14
14
|
|
15
|
-
|
15
|
+
compare_key_paths_and_values(keys, actual, expected)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def compare_key_paths_and_values(keys, actual, expected)
|
21
|
+
keys.all? do |key_path|
|
16
22
|
actual_value = actual.dig(*key_path)
|
17
23
|
expected_value = expected.dig(*key_path)
|
18
24
|
|
@@ -20,8 +26,6 @@ module RSpec
|
|
20
26
|
end
|
21
27
|
end
|
22
28
|
|
23
|
-
private
|
24
|
-
|
25
29
|
def compare_hash_values(actual_value, expected_value)
|
26
30
|
case expected_value
|
27
31
|
when Class
|
@@ -42,7 +46,7 @@ module RSpec
|
|
42
46
|
end
|
43
47
|
|
44
48
|
def compare_regexp(actual_value, expected_value)
|
45
|
-
actual_value =~ expected_value
|
49
|
+
actual_value.to_s =~ expected_value
|
46
50
|
end
|
47
51
|
|
48
52
|
def compare_proc(actual_value, expected_value)
|
@@ -88,10 +92,10 @@ module RSpec
|
|
88
92
|
|
89
93
|
actual_value.all? { |elem| compare(elem, interface) }
|
90
94
|
else
|
91
|
-
return false if actual_value
|
95
|
+
return false if actual_value&.size != expected_value&.size
|
92
96
|
|
93
|
-
|
94
|
-
elem.is_a?(Hash) ? compare(
|
97
|
+
expected_value.each_with_index.all? do |elem, index|
|
98
|
+
elem.is_a?(Hash) ? compare(actual_value[index], elem) : compare_value(actual_value[index], elem)
|
95
99
|
end
|
96
100
|
end
|
97
101
|
end
|
data/rspec-json_api.gemspec
CHANGED
@@ -27,9 +27,9 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
29
|
# Uncomment to register a new dependency of your gem
|
30
|
-
spec.add_dependency "activesupport", "
|
31
|
-
spec.add_dependency "rails", "
|
32
|
-
spec.add_dependency "rspec-rails", "
|
30
|
+
spec.add_dependency "activesupport", ">= 6.1.4.1"
|
31
|
+
spec.add_dependency "rails", ">= 6.1.4.1"
|
32
|
+
spec.add_dependency "rspec-rails", ">= 5.0.2"
|
33
33
|
|
34
34
|
# For more information and examples about making a new gem, checkout our
|
35
35
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,22 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-json_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Gajowiak
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '6.1'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 6.1.4.1
|
@@ -24,9 +21,6 @@ dependencies:
|
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '6.1'
|
30
24
|
- - ">="
|
31
25
|
- !ruby/object:Gem::Version
|
32
26
|
version: 6.1.4.1
|
@@ -34,9 +28,6 @@ dependencies:
|
|
34
28
|
name: rails
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '6.1'
|
40
31
|
- - ">="
|
41
32
|
- !ruby/object:Gem::Version
|
42
33
|
version: 6.1.4.1
|
@@ -44,9 +35,6 @@ dependencies:
|
|
44
35
|
prerelease: false
|
45
36
|
version_requirements: !ruby/object:Gem::Requirement
|
46
37
|
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '6.1'
|
50
38
|
- - ">="
|
51
39
|
- !ruby/object:Gem::Version
|
52
40
|
version: 6.1.4.1
|
@@ -54,9 +42,6 @@ dependencies:
|
|
54
42
|
name: rspec-rails
|
55
43
|
requirement: !ruby/object:Gem::Requirement
|
56
44
|
requirements:
|
57
|
-
- - "~>"
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '5.0'
|
60
45
|
- - ">="
|
61
46
|
- !ruby/object:Gem::Version
|
62
47
|
version: 5.0.2
|
@@ -64,9 +49,6 @@ dependencies:
|
|
64
49
|
prerelease: false
|
65
50
|
version_requirements: !ruby/object:Gem::Requirement
|
66
51
|
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '5.0'
|
70
52
|
- - ">="
|
71
53
|
- !ruby/object:Gem::Version
|
72
54
|
version: 5.0.2
|
@@ -81,6 +63,7 @@ files:
|
|
81
63
|
- ".gitignore"
|
82
64
|
- ".rspec"
|
83
65
|
- ".rubocop.yml"
|
66
|
+
- ".ruby-version"
|
84
67
|
- CHANGELOG.md
|
85
68
|
- CODE_OF_CONDUCT.md
|
86
69
|
- Gemfile
|
@@ -130,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
113
|
- !ruby/object:Gem::Version
|
131
114
|
version: '0'
|
132
115
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
116
|
+
rubygems_version: 3.4.10
|
134
117
|
signing_key:
|
135
118
|
specification_version: 4
|
136
119
|
summary: RSpec extension to test JSON API response.
|