override 0.0.8 → 0.0.9

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/override.rb +9 -1
  2. data/test/all_test.rb +1 -1
  3. metadata +1 -1
@@ -13,9 +13,17 @@ module Override
13
13
 
14
14
  def expect object, method, options
15
15
  expectation = lambda do |*params|
16
- raise ArgumentError unless params == options[:with]
16
+ unless params == options[:with]
17
+ raise ExpectationError.new(options[:with], params)
18
+ end
17
19
  options[:return]
18
20
  end
19
21
  override(object, method => expectation)
20
22
  end
23
+
24
+ class ExpectationError < ArgumentError
25
+ def initialize(expected, actual)
26
+ super("Expected #{expected.inspect}, got #{actual.inspect}")
27
+ end
28
+ end
21
29
  end
@@ -187,7 +187,7 @@ class TestOverride < Test::Unit::TestCase
187
187
  end
188
188
 
189
189
  should "raises an error if expectations are not met" do
190
- assert_raise ArgumentError do
190
+ assert_raise Override::ExpectationError do
191
191
  @foo.bar "Michel", 31
192
192
  end
193
193
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: override
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Martens