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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dae6095a7d2697060a9beec3ed57f081c564f2c3767a4b0678bc8fa9f3bc0083
4
- data.tar.gz: 8ac43267a6ffc68f7578b3f7e8f56e7800a599e64ea48c243626b1f0e369728d
3
+ metadata.gz: 6f40d1a16f0eff4c046c4598ace80041df867575e52065a1b1dd298ec9cf98d6
4
+ data.tar.gz: 8aae365879c35374679dac663a490bdb5018a3646f8b30e64836700220aed5fb
5
5
  SHA512:
6
- metadata.gz: 6b0369b6150765bd4424a4fcac37e1d4f65b3bae8067369b83be627b370b2b87e934ce5a8264c79a8378b9953a0c877273f4287438179addbfc0360241e00346
7
- data.tar.gz: ae9a6841e079ee88edf9b8a9c5182ddb8199684f9b4787346f76ad1c72454e60ee567cc7b85a4954fcb748fb2f3116f63abd4ed2d5d2004bb9fa8ac3f36cfa8a
6
+ metadata.gz: 8a5b5fe0e572b4e1424ebd7e32d1d0178046ee111e1c9e69f09fbae69eda8c273fd98498570c6ab7a4b58c12b214d11bfd8eec701e1b4502770826cd2c1cf724
7
+ data.tar.gz: 82afdf75029cd84a8ae8bd84335a4ef48e5dab5db0682018a79a2f799991fcc1af8c069fd01abd3905fe4ee468e46d28cbc615e0cf4d5c8e80133e10abd309d7
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/Gemfile CHANGED
@@ -9,5 +9,3 @@ gemspec
9
9
  gem "activesupport", "~> 6.1", ">= 6.1.4.1"
10
10
  gem "rake", "~> 13.0", ">= 13.0.6"
11
11
  gem "rspec-rails", "~> 5.0", ">= 5.0.2"
12
-
13
-
data/Gemfile.lock CHANGED
@@ -1,68 +1,68 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-json_api (1.0.0)
5
- activesupport (~> 6.1, >= 6.1.4.1)
6
- rails (~> 6.1, >= 6.1.4.1)
7
- rspec-rails (~> 5.0, >= 5.0.2)
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.1)
13
- actionpack (= 6.1.4.1)
14
- activesupport (= 6.1.4.1)
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.1)
18
- actionpack (= 6.1.4.1)
19
- activejob (= 6.1.4.1)
20
- activerecord (= 6.1.4.1)
21
- activestorage (= 6.1.4.1)
22
- activesupport (= 6.1.4.1)
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.1)
25
- actionpack (= 6.1.4.1)
26
- actionview (= 6.1.4.1)
27
- activejob (= 6.1.4.1)
28
- activesupport (= 6.1.4.1)
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.1)
32
- actionview (= 6.1.4.1)
33
- activesupport (= 6.1.4.1)
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.1)
39
- actionpack (= 6.1.4.1)
40
- activerecord (= 6.1.4.1)
41
- activestorage (= 6.1.4.1)
42
- activesupport (= 6.1.4.1)
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.1)
45
- activesupport (= 6.1.4.1)
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.1)
51
- activesupport (= 6.1.4.1)
50
+ activejob (6.1.4.4)
51
+ activesupport (= 6.1.4.4)
52
52
  globalid (>= 0.3.6)
53
- activemodel (6.1.4.1)
54
- activesupport (= 6.1.4.1)
55
- activerecord (6.1.4.1)
56
- activemodel (= 6.1.4.1)
57
- activesupport (= 6.1.4.1)
58
- activestorage (6.1.4.1)
59
- actionpack (= 6.1.4.1)
60
- activejob (= 6.1.4.1)
61
- activerecord (= 6.1.4.1)
62
- activesupport (= 6.1.4.1)
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.1)
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
- diff-lcs (1.4.4)
74
+ date (3.3.4)
75
+ diff-lcs (1.5.0)
75
76
  erubi (1.10.0)
76
- globalid (0.5.2)
77
- activesupport (>= 5.0)
78
- i18n (1.8.10)
77
+ globalid (1.2.1)
78
+ activesupport (>= 6.1)
79
+ i18n (1.9.1)
79
80
  concurrent-ruby (~> 1.0)
80
- loofah (2.12.0)
81
+ loofah (2.13.0)
81
82
  crass (~> 1.0.2)
82
83
  nokogiri (>= 1.5.9)
83
- mail (2.7.1)
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.2)
88
- minitest (5.14.4)
89
- nio4r (2.5.8)
90
- nokogiri (1.12.4-x86_64-darwin)
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.5.2)
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.1)
97
- actioncable (= 6.1.4.1)
98
- actionmailbox (= 6.1.4.1)
99
- actionmailer (= 6.1.4.1)
100
- actionpack (= 6.1.4.1)
101
- actiontext (= 6.1.4.1)
102
- actionview (= 6.1.4.1)
103
- activejob (= 6.1.4.1)
104
- activemodel (= 6.1.4.1)
105
- activerecord (= 6.1.4.1)
106
- activestorage (= 6.1.4.1)
107
- activesupport (= 6.1.4.1)
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.1)
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.1)
117
- actionpack (= 6.1.4.1)
118
- activesupport (= 6.1.4.1)
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.1)
138
+ rspec-core (3.10.2)
124
139
  rspec-support (~> 3.10.0)
125
- rspec-expectations (3.10.1)
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.2)
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.2)
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.2)
140
- sprockets (4.0.2)
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.2.2)
144
- actionpack (>= 4.0)
145
- activesupport (>= 4.0)
158
+ sprockets-rails (3.4.2)
159
+ actionpack (>= 5.2)
160
+ activesupport (>= 5.2)
146
161
  sprockets (>= 3.0.0)
147
- thor (1.1.0)
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.5)
166
+ websocket-driver (0.7.6)
151
167
  websocket-extensions (>= 0.1.0)
152
168
  websocket-extensions (0.1.5)
153
- zeitwerk (2.4.2)
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 `spec_helper.rb`
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 }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Extention methods for hash class
3
+ # Extension methods for hash class
4
4
  class Hash
5
5
  def deep_keys
6
6
  each_with_object([]) do |(k, v), keys|
@@ -10,9 +10,15 @@ module RSpec
10
10
  def compare(actual, expected)
11
11
  return false if actual.blank? && expected.present?
12
12
 
13
- key_paths = actual.deep_key_paths
13
+ keys = expected.deep_key_paths | actual.deep_key_paths
14
14
 
15
- key_paths.all? do |key_path|
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.size != expected_value.size
95
+ return false if actual_value&.size != expected_value&.size
92
96
 
93
- actual_value.each_with_index.all? do |elem, index|
94
- elem.is_a?(Hash) ? compare(elem, expected_value[index]) : compare_value(elem, expected_value[index])
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module JsonApi
5
- VERSION = "1.0.2"
5
+ VERSION = "1.1.1"
6
6
  end
7
7
  end
@@ -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", "~> 6.1", ">= 6.1.4.1"
31
- spec.add_dependency "rails", "~> 6.1", ">= 6.1.4.1"
32
- spec.add_dependency "rspec-rails", "~> 5.0", ">= 5.0.2"
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.0.2
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: 2021-12-22 00:00:00.000000000 Z
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.2.16
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.