rspec-rcv 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec90fa76a46e06a3ba69e484769b96a1421172fc
4
- data.tar.gz: faaffb61b21a100fe5f528bdf070f7223cb76ee2
3
+ metadata.gz: 02eff6d1f5ac8aa97be5c4811229b3b9f13d7d9a
4
+ data.tar.gz: 21b35d9f622f990f8b869e576431d1fa116c5a3a
5
5
  SHA512:
6
- metadata.gz: cef16582a6c7405e6bd3023af569ce81eeabfb941cf57577bd3019efcb295407b78173b897fe8880aa6ddec7fba06cbb5a200e08d7917fcbd0d455b73c2a37b3
7
- data.tar.gz: e76fce5d7ddc0f7e2f07a56c0b68ee56cce349d10c54611be77921f75c55a7b0e3eeb61f700061d43b46ba1027591afcbd30068bce7aaaa2a3f509c0e84b1a6c
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: "DIFF,
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.respond_to?(:to_h)
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
@@ -1,3 +1,3 @@
1
1
  module RSpecRcv
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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-26 00:00:00.000000000 Z
11
+ date: 2015-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler