class Rspec::Something::Proxy
Public Class Methods
new(_double)
click to toggle source
# File lib/rspec/something/proxy.rb, line 5 def initialize(_double) @_won_t = false @double = _double end
Public Instance Methods
method_missing(name, *args)
click to toggle source
set expectation to double at first method invocation and return double itself.
# File lib/rspec/something/proxy.rb, line 13 def method_missing(name, *args) (should_be_received? ? @double.should_receive(name) : @double.should_not_receive(name)) .tap {|o| o.with(*args) unless args.empty? } @double end
won_t()
click to toggle source
# File lib/rspec/something/proxy.rb, line 20 def won_t @_won_t = true self end
Private Instance Methods
should_be_received?()
click to toggle source
# File lib/rspec/something/proxy.rb, line 27 def should_be_received? !@_won_t end