rspec-resembles_json_matchers 0.7.2 → 0.7.3

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: 142c673e3380c25a8f69508c2ba4dd7a89bdb11dfe70f2ba0493404396290110
4
- data.tar.gz: 9f36028f25d03b72e791784dbd68a052101ce26ad1a70f5f309624eca0fab425
3
+ metadata.gz: bc45f9e78cd12d10e4fc69f32ec8d769457c8d4faff0a494dd9b0d10f1e00ca5
4
+ data.tar.gz: 8b71e34ddb22051a25b6718160d915821cc2c69e4c918b25cb55bd8041d7a59f
5
5
  SHA512:
6
- metadata.gz: 33a000fb317446e635fa617fb7943081add5254aec98c081106925c90b48f0f151c6d27abbbe384b3dd2aed7a6ffdc44008f1fc49b66f8d6af3cf6ce2269f957
7
- data.tar.gz: '0691dffd2f1b9e07a552a5a281a2407da6d0801cd057b01855013b62409ac64df226fabca892f53bf6e70a991ec6a7c52753dae9dc0b7165a99413c0d0696c39'
6
+ metadata.gz: c10591785aba3c745864adb9ff7d07c809067ec2b5463a4b93337dcd0fe1799affb03ab4f82cfdafac57466d0d0558a1202d2d83fa30b34ea66e6ed392ef8e6c
7
+ data.tar.gz: 855818de72c091fe87624b93fb1600b78a585eff0a1474415ba81e7ad8496f4a33676b5f3dde0da04b313c72cf070151f7789e4e208209e9a78410a4bd350594
data/Changelog.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.7.3
2
+
3
+ - Add a few more missing render methods
4
+ - Only try to call indifferent_access on Hashes
5
+
1
6
  # 0.7.2
2
7
 
3
8
  - Expose `expected` in the nil matcher so the description can be rendered
@@ -107,6 +107,10 @@ module RSpec::ResemblesJsonMatchers
107
107
  @buffer.print prefix + "]"
108
108
  end
109
109
 
110
+ def render_ResemblesBooleanMatcher(matcher, **opts)
111
+ @buffer.print matcher.expected.to_json
112
+ end
113
+
110
114
  def render_ResemblesStringMatcher(matcher, **opts)
111
115
  @buffer.print matcher.expected.to_json
112
116
  end
@@ -127,6 +131,10 @@ module RSpec::ResemblesJsonMatchers
127
131
  @buffer.print "null"
128
132
  end
129
133
 
134
+ def render_ResemblesRouteMatcher(matcher, **opts)
135
+ @buffer.print matcher.expected.inspect
136
+ end
137
+
130
138
  def method_missing(method_name, *args, &block)
131
139
  if method_name.to_s.start_with?("render_")
132
140
  raise NoMethodError, method_name if method_name.to_s.end_with?("Matcher")
@@ -16,7 +16,7 @@ module RSpec::ResemblesJsonMatchers
16
16
  end
17
17
 
18
18
  def matches?(document)
19
- @document = document.with_indifferent_access
19
+ @document = document.try(:with_indifferent_access)
20
20
 
21
21
  @matched = !missing_attribute? && expected.matches?(actual_value)
22
22
  end
@@ -15,11 +15,11 @@ module RSpec::ResemblesJsonMatchers
15
15
  attr_reader :expected, :actual
16
16
 
17
17
  def initialize(expected_json)
18
- @expected = expected_json.deep_stringify_keys
18
+ @expected = expected_json.try(:deep_stringify_keys)
19
19
  end
20
20
 
21
21
  def matches?(actual_json)
22
- @actual = actual_json.deep_stringify_keys
22
+ @actual = actual_json.try(:deep_stringify_keys)
23
23
  all_passed = true
24
24
  expected_matchers.each do |key, attr_matcher|
25
25
  result = attr_matcher.matches?(actual)
@@ -5,6 +5,8 @@ module RSpec::ResemblesJsonMatchers
5
5
  bool.is_a?(TrueClass) || bool.is_a?(FalseClass)
6
6
  end
7
7
 
8
+ attr_reader :expected
9
+
8
10
  def initialize(expected)
9
11
  @expected = expected
10
12
  end
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module ResemblesJsonMatchers
3
- VERSION = "0.7.2"
3
+ VERSION = "0.7.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-resembles_json_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Sadauskas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-12 00:00:00.000000000 Z
11
+ date: 2018-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler