lib/mspec/mocks/proxy.rb in mspec-1.5.11 vs lib/mspec/mocks/proxy.rb in mspec-1.5.12
- old
+ new
@@ -7,10 +7,24 @@
def method_missing(sym, *args, &block)
@null ? self : super
end
end
+class NumericMockObject < Numeric
+ def initialize(name, options={})
+ @name = name
+ @null = options[:null_object]
+ end
+
+ def method_missing(sym, *args, &block)
+ @null ? self : super
+ end
+
+ def singleton_method_added(val)
+ end
+end
+
class MockProxy
def initialize(type=nil)
@multiple_returns = nil
@returning = nil
@yielding = []
@@ -86,11 +100,11 @@
end
def with(*args)
raise ArgumentError, "you must specify the expected arguments" if args.empty?
@arguments = *args
- if RUBY_VERSION >= '1.9'
+ if (behaves_like_ruby_1_9 = *[])
@arguments = @arguments.first if @arguments.length <= 1
end
self
end
@@ -110,14 +124,14 @@
def and_yield(*args)
@yielding << args
self
end
-
+
def yielding
@yielding
end
-
+
def yielding?
!@yielding.empty?
end
private