module KickTheTires

Constants

SOURCE

Public Instance Methods

assert(a_thing) click to toggle source
# File lib/kick_the_tires.rb, line 39
def assert(a_thing)
  return if @ktt_disabled
  assert_equal true, a_thing
end
assert_equal(expected_this, got_that) click to toggle source
# File lib/kick_the_tires.rb, line 49
def assert_equal(expected_this, got_that)
  return if @ktt_disabled
  unless expected_this.to_s == got_that.to_s
    show_source
    puts 'Result #=>'
    puts "Expected This: #{expected_this}"
    puts "But Got That:  #{got_that}"
    puts
  end
end
give_the_keys_back() click to toggle source
# File lib/kick_the_tires.rb, line 65
def give_the_keys_back
  @ktt_disabled = false
end
out_for_a_drive?() click to toggle source
# File lib/kick_the_tires.rb, line 69
def out_for_a_drive?
  @ktt_disabled
end
refute(a_thing) click to toggle source
# File lib/kick_the_tires.rb, line 44
def refute(a_thing)
  return if @ktt_disabled
  assert_equal false, a_thing
end
show(a_thing) click to toggle source
# File lib/kick_the_tires.rb, line 32
def show(a_thing)
  return if @ktt_disabled
  show_source
  puts "Showing #{a_thing.class} #=>"
  ap a_thing, {indent: 2, raw: true}
end
show_source() click to toggle source
# File lib/kick_the_tires.rb, line 23
def show_source
  return if @ktt_disabled
  puts
  puts "-"*75
  a_string    = caller.last
  source_line = a_string.split(' ').first.split(':')[1].to_i
  puts "Source #=> [#{source_line}] #{SOURCE[source_line-1]}" # MAGIC: zero-based index
end
take_it_for_a_spin() click to toggle source

disable the asserts and shows

# File lib/kick_the_tires.rb, line 61
def take_it_for_a_spin
  @ktt_disabled = true
end