Module: Spark

Defined in:
lib/spark.rb,
lib/spark/rake/speck_task.rb

Defined Under Namespace

Modules: Rake

Constant Summary collapse

Version =
0

Class Method Summary collapse

Class Method Details

.playback(speck) ⇒ Object

“Plays” a ‘Speck` back, recursively. This consists of:

  • Printing data about the ‘Speck`

  • Executing the ‘Speck`

  • Executing each ‘Check` belonging to the `Speck`

  • Printing data about each ‘Check` and its result

  • Recursively repeating the above for each child ‘Speck`



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/spark.rb', line 16

def playback speck
  speck.execute

  speck.checks.each do |check|
    begin
      check.execute
      # TODO: Provide more useful information about the return value and
      #       expected return value
      # TODO: Colorize negated Checks with the bang as red, or something
      #       similar
      puts check.description.ljust(72) + (" # => " + check.status.inspect).green
    rescue Speck::Exception::CheckFailed
      # TODO: Print a description of why the error failed, what was expected
      #       and what was actually received.
      puts check.description.ljust(72) + (" # !  " + check.status.inspect).red
    end
  end

  speck.children.each {|speck| Spark.playback speck }
end