soveran-override 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/override.rb +9 -1
- data/test/all_test.rb +1 -1
- metadata +1 -1
data/lib/override.rb
CHANGED
@@ -13,9 +13,17 @@ module Override
|
|
13
13
|
|
14
14
|
def expect object, method, options
|
15
15
|
expectation = lambda do |*params|
|
16
|
-
|
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
|
data/test/all_test.rb
CHANGED