contrast 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - jruby-18mode
7
+ - jruby-19mode
8
+ - rbx-18mode
9
+ - rbx-19mode
10
+ - jruby-head
11
+ - ree
data/Gemfile CHANGED
@@ -8,6 +8,7 @@ gem 'subtle'
8
8
  gem 'awesome_print'
9
9
 
10
10
  group :development do
11
+ gem 'minitest'
11
12
  gem 'mocha'
12
13
  gem 'guard'
13
14
  gem 'guard-minitest', :git => 'git://github.com/aspiers/guard-minitest.git'
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Contrast
1
+ # Contrast [![Build Status](https://secure.travis-ci.org/darrencauthon/contrast.png?branch=master)](http://travis-ci.org/darrencauthon/contrast)
2
2
 
3
3
  TODO: Write a gem description
4
4
 
data/Rakefile CHANGED
@@ -1,2 +1,11 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+ require 'rake/testtask'
4
+
5
+ task :default => [:test]
6
+
7
+ Rake::TestTask.new do |t|
8
+ t.libs.push "lib"
9
+ t.test_files = FileList['spec/contrast/*_spec.rb']
10
+ t.verbose = true
11
+ end
@@ -24,9 +24,9 @@ module Contrast
24
24
 
25
25
  def get_the_value(object, field)
26
26
  begin
27
- object.send(field)
28
- rescue
29
27
  object[field]
28
+ rescue
29
+ object.send(field)
30
30
  end
31
31
  end
32
32
 
@@ -1,3 +1,3 @@
1
1
  module Contrast
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -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.1
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-11 00:00:00.000000000 Z
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