class Crabfarm::RSpec::ReducerSpyManager
Public Class Methods
new()
click to toggle source
# File lib/crabfarm/rspec/reducer_spy_manager.rb, line 8 def initialize @spies = {} end
Public Instance Methods
new_spy_for(_reducer_class)
click to toggle source
# File lib/crabfarm/rspec/reducer_spy_manager.rb, line 12 def new_spy_for(_reducer_class) @spies[_reducer_class.to_s] = ReducerSpy.new(_reducer_class) end
prepare(_class, _target, _params)
click to toggle source
reducer decorator implementation
# File lib/crabfarm/rspec/reducer_spy_manager.rb, line 18 def prepare(_class, _target, _params) spy = @spies[_class.to_s] unless spy.nil? spy.register_call _target, _params if spy.mock mock = _class.new _target, _params mock.mock spy.mock def mock.run # do nothing end return mock end end nil end