Class: Stories::ForrestRunnerAll

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

Constant Summary collapse

@@all_stories =
[]

Instance Method Summary collapse

Instance Method Details

#add_fault(fault) ⇒ Object



12
13
14
# File 'lib/forrest/all_runner.rb', line 12

def add_fault(fault)
  @faults << fault
end

#finished(elapsed_time) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/forrest/all_runner.rb', line 48

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

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

end


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/forrest/all_runner.rb', line 16

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

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

  puts
end

#print_storyObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/forrest/all_runner.rb', line 33

def print_story
  set_story
  puts @story.inspect
  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



28
29
30
31
# File 'lib/forrest/all_runner.rb', line 28

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

#test_finished(name) ⇒ Object



8
9
10
# File 'lib/forrest/all_runner.rb', line 8

def test_finished(name)
  set_story
end