hash_dealer 1.4.1 → 1.4.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.1
1
+ 1.4.2
data/hash_dealer.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "hash_dealer"
8
- s.version = "1.4.1"
8
+ s.version = "1.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Langevin"]
@@ -73,6 +73,10 @@ class String
73
73
  alias_method "==_without_path_string", :==
74
74
  alias_method :==, "==_with_path_string"
75
75
  alias_method :eql?, :==
76
+ # make a string bold
77
+ def bold
78
+ "\033[1m#{self}"
79
+ end
76
80
  end
77
81
 
78
82
  class Hash
data/lib/matcher.rb CHANGED
@@ -2,6 +2,18 @@
2
2
  require 'rspec'
3
3
  require 'pp'
4
4
 
5
+
6
+ def print_diff(diff, depth = 1)
7
+ puts "#{"\t" * depth}" + "HashDealer::#{diff.first.to_s}".bold.cyan + "\tResponse::#{diff.last.to_s}".bold.yellow if diff.is_a?(Array)
8
+ if diff.is_a?(Hash)
9
+ diff.each_pair do |k, v|
10
+ puts "\n"
11
+ puts (("\t" * depth) + k).red
12
+ print_diff(v, depth + 1)
13
+ end
14
+ end
15
+ end
16
+
5
17
  RSpec::Matchers.define(:match_response) do |actual|
6
18
 
7
19
  actual = Comparator.normalize_value(actual)
@@ -13,11 +25,17 @@ RSpec::Matchers.define(:match_response) do |actual|
13
25
  end
14
26
 
15
27
  failure_message_for_should do |container|
16
- @diff.pretty_inspect
28
+ puts "\n"
29
+ print_diff(@diff)
30
+ puts "\n"
31
+ ""
17
32
  end
18
33
 
19
34
  failure_message_for_should_not do |container|
20
- @diff.pretty_inspect
35
+ puts "\n"
36
+ print_diff(@diff)
37
+ puts "\n"
38
+ ""
21
39
  end
22
40
  end
23
41
 
@@ -35,11 +53,17 @@ RSpec::Matchers.define(:match_list) do |actual|
35
53
  end
36
54
 
37
55
  failure_message_for_should do |container|
38
- @diff.pretty_inspect
56
+ puts "\n"
57
+ print_diff(@diff)
58
+ puts "\n"
59
+ ""
39
60
  end
40
61
 
41
62
  failure_message_for_should_not do |container|
42
- @diff.pretty_inspect
63
+ puts "\n"
64
+ print_diff(@diff)
65
+ puts "\n"
66
+ ""
43
67
  end
44
68
 
45
69
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hash_dealer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.1
5
+ version: 1.4.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dan Langevin
@@ -153,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
154
  - - ">="
155
155
  - !ruby/object:Gem::Version
156
- hash: -3389407329229764576
156
+ hash: 1097571649744545585
157
157
  segments:
158
158
  - 0
159
159
  version: "0"