Class: Stories::ForrestRunner

Inherits:
Test::Unit::UI::Console::TestRunner
  • Object
show all
Defined in:
lib/forrest/runner.rb,
lib/forrest/runner_flymake.rb

Instance Method Summary collapse

Instance Method Details

#add_fault(fault) ⇒ Object



10
11
12
# File 'lib/forrest/runner.rb', line 10

def add_fault(fault)
  @faults << fault
end

#finished(elapsed_time) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/forrest/runner.rb', line 43

def finished(elapsed_time)
  puts
  print_story
  super
  stories_count   = 1
  scenarios_count = @story.scenarios.size

  puts colorize("#{stories_count} story, ", :bold) +
       colorize(" #{scenarios_count} scenarios", :bold)

end


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/forrest/runner.rb', line 19

def print_scenario(scenario)
  scenario.steps.each do |step|
    puts "      #{step}"
  end

  scenario.assertions.each do |assertion|
    puts "      #{assertion}"
  end

  puts
end

#print_storyObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/forrest/runner.rb', line 31

def print_story
  puts "- #{colorize(@story.name, :bold)} \n\n"

  @story.scenarios.each do |scenario|
    puts "    #{scenario.name}"

    unless scenario.steps.empty? && scenario.assertions.empty?
      print_scenario scenario
    end
  end
end

#set_storyObject



14
15
16
17
# File 'lib/forrest/runner.rb', line 14

def set_story
  s      ||= Story.new @suite.name
  @story ||= Stories.all[s.name.constantize]
end

#test_finished(name) ⇒ Object



6
7
8
# File 'lib/forrest/runner.rb', line 6

def test_finished(name)
  set_story
end