Module: TrackIfs

Defined in:
lib/spec/spec_helper.rb

Instance Method Summary collapse

Instance Method Details

#my_ifObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/spec/spec_helper.rb', line 44

def my_if
  # Dummy if that increments @my_if_calls, then runs as normal
  @my_if ||= lambda do |condition, then_do, else_do|
    @my_if_calls += 1
    if condition.call 
      then_do.call
    else 
      else_do.call
    end
  end
end