override 0.0.8 → 0.0.9
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/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