rspec-rcv 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/rspec-rcv/helpers/deep_except.rb +9 -2
- data/lib/rspec-rcv/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02eff6d1f5ac8aa97be5c4811229b3b9f13d7d9a
|
4
|
+
data.tar.gz: 21b35d9f622f990f8b869e576431d1fa116c5a3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c328ad24877c9a0bad5fe779b05f802359a1262f1e374370c68811c221e6d9222b6c50982148c6a35a9178edb040215b1bef3693695e22d443677a6153666b99
|
7
|
+
data.tar.gz: 1e3f1abf5f0f0f3de5f76e277943d06ffee271e3334bff2fe3ab1443cb09b5b6085cc60db0e87e8b5a02c01e7172fd51fb7c8717c3252efcefe83d6998c184e8
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ the file in the spec suite.
|
|
33
33
|
The following options are available to override, as well as important default values:
|
34
34
|
|
35
35
|
```ruby
|
36
|
-
config.exportable_proc = Proc.new { response.body }
|
36
|
+
config.exportable_proc = Proc.new { JSON.parse(response.body) }
|
37
37
|
config.compare_with # Deep ignoring comparison by default
|
38
38
|
config.codec = Codecs::PrettyJson.new
|
39
39
|
config.ignore_keys = []
|
@@ -44,6 +44,8 @@ config.fail_on_changed_output = true
|
|
44
44
|
`exportable_proc`, `compare_with` must implement `.call`. For `exportable_proc`, the result will be written to disk
|
45
45
|
and should be a String. For `compare_with`, the proc should return true when existing and new are considered equal.
|
46
46
|
|
47
|
+
`exportable_proc` assumes JSON response by default, but could be override to allow for other types of responses.
|
48
|
+
|
47
49
|
`codec` must implement `export_with(hash)` and `decode_with(str)`. There is a PrettyJson and Yaml codec included in this gem,
|
48
50
|
and PrettyJson is the default as it can be directly consumed by javascript.
|
49
51
|
|
@@ -64,7 +66,7 @@ the following hashes would not trigger a change with `ignore_keys = [:id]`
|
|
64
66
|
{
|
65
67
|
id: "DIFF",
|
66
68
|
deep: {
|
67
|
-
id
|
69
|
+
"id" => "DIFF,
|
68
70
|
name: "Steve"
|
69
71
|
}
|
70
72
|
}
|
@@ -13,9 +13,16 @@ module RSpecRcv
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def inject(hash, except)
|
16
|
+
return hash unless hash.is_a?(Hash)
|
17
|
+
|
16
18
|
hash.inject({}) do |h, (k, v)|
|
17
|
-
if v && v.
|
18
|
-
h[k] = inject(v, except)
|
19
|
+
if v && v.is_a?(Hash)
|
20
|
+
h[k] = inject(v, except) unless except.include?(k.to_sym)
|
21
|
+
elsif v && v.is_a?(Array)
|
22
|
+
v.each_with_index do |item, index|
|
23
|
+
v[index] = inject(item, except)
|
24
|
+
end
|
25
|
+
h[k] = v unless except.include?(k.to_sym)
|
19
26
|
elsif !except.include?(k.to_sym)
|
20
27
|
h[k] = v
|
21
28
|
end
|
data/lib/rspec-rcv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rcv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Bussey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|