contrast 0.2.1 → 0.2.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/.travis.yml +11 -0
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +9 -0
- data/lib/contrast/detective.rb +2 -2
- data/lib/contrast/version.rb +1 -1
- data/spec/contrast_spec.rb +49 -0
- metadata +3 -2
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/contrast/detective.rb
CHANGED
data/lib/contrast/version.rb
CHANGED
data/spec/contrast_spec.rb
CHANGED
@@ -53,6 +53,55 @@ describe "examples" do
|
|
53
53
|
#this statement will force an exception
|
54
54
|
begin
|
55
55
|
first.contrast_with!(second, fields)
|
56
|
+
raise 'It did not cause an exception.'
|
57
|
+
rescue
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should compare objects to hashes" do
|
62
|
+
fields = [:first_name, :last_name, :city, :state, :zip]
|
63
|
+
example_objects = fields.to_objects {[
|
64
|
+
['a', 'b', 'c', 'd', 'e'],
|
65
|
+
]}
|
66
|
+
|
67
|
+
first = example_objects[0]
|
68
|
+
second = { :first_name => 'z',
|
69
|
+
:last_name => 'b',
|
70
|
+
:city => 'c',
|
71
|
+
:state => 'd',
|
72
|
+
:zip => 'e' }
|
73
|
+
|
74
|
+
first.contrast_with(second, fields).count.must_equal 1
|
75
|
+
second.contrast_with(first, fields).count.must_equal 1
|
76
|
+
|
77
|
+
#this statement will force an exception
|
78
|
+
begin
|
79
|
+
first.contrast_with!(second, fields)
|
80
|
+
raise 'It did not cause an exception.'
|
81
|
+
rescue
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should compare hashes to hashes" do
|
86
|
+
fields = [:first_name, :last_name, :city, :state, :zip]
|
87
|
+
first = { :first_name => 'a',
|
88
|
+
:last_name => 'b',
|
89
|
+
:city => 'c',
|
90
|
+
:state => 'd',
|
91
|
+
:zip => 'e' }
|
92
|
+
second = { :first_name => 'z',
|
93
|
+
:last_name => 'b',
|
94
|
+
:city => 'c',
|
95
|
+
:state => 'd',
|
96
|
+
:zip => 'e' }
|
97
|
+
|
98
|
+
first.contrast_with(second, fields).count.must_equal 1
|
99
|
+
second.contrast_with(first, fields).count.must_equal 1
|
100
|
+
|
101
|
+
#this statement will force an exception
|
102
|
+
begin
|
103
|
+
first.contrast_with!(second, fields)
|
104
|
+
raise 'It did not cause an exception.'
|
56
105
|
rescue
|
57
106
|
end
|
58
107
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contrast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: subtle
|
@@ -84,6 +84,7 @@ extra_rdoc_files: []
|
|
84
84
|
files:
|
85
85
|
- .gitignore
|
86
86
|
- .rvmrc
|
87
|
+
- .travis.yml
|
87
88
|
- Gemfile
|
88
89
|
- Guardfile
|
89
90
|
- LICENSE
|