beefcake 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/beefcake.rb +4 -0
  2. data/test/message_test.rb +8 -0
  3. metadata +3 -3
data/lib/beefcake.rb CHANGED
@@ -198,6 +198,10 @@ module Beefcake
198
198
  __send__("#{k}=", v)
199
199
  end
200
200
 
201
+ def ==(o)
202
+ fields.values.all? {|fld| self[fld.name] == o[fld.name] }
203
+ end
204
+
201
205
  end
202
206
 
203
207
  end
data/test/message_test.rb CHANGED
@@ -283,4 +283,12 @@ class MessageTest < Test::Unit::TestCase
283
283
  assert_equal 1, got.a
284
284
  end
285
285
 
286
+ def test_equality
287
+ a = SimpleMessage.new :a => 1
288
+ b = SimpleMessage.new :a => 1
289
+ assert_equal a, b
290
+ c = SimpleMessage.new :a => 2
291
+ assert_not_equal b, c
292
+ end
293
+
286
294
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Blake Mizerany
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-26 00:00:00 -08:00
17
+ date: 2011-01-28 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency