Class: Stories::ForrestScenarioRunner
- Inherits:
-
Test::Unit::UI::Console::TestRunner
- Object
- Test::Unit::UI::Console::TestRunner
- Stories::ForrestScenarioRunner
- Defined in:
- lib/forrest/scenario_runner.rb
Instance Method Summary collapse
- #add_fault(fault) ⇒ Object
- #finished(elapsed_time) ⇒ Object
- #print_scenario ⇒ Object
- #print_story ⇒ Object
- #set_scenario ⇒ Object
- #set_story ⇒ Object
- #test_finished(name) ⇒ Object
Instance Method Details
#add_fault(fault) ⇒ Object
14 15 16 |
# File 'lib/forrest/scenario_runner.rb', line 14 def add_fault(fault) @faults << fault end |
#finished(elapsed_time) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/forrest/scenario_runner.rb', line 56 def finished(elapsed_time) puts print_story super end |
#print_scenario ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/forrest/scenario_runner.rb', line 27 def print_scenario @scenario.steps.each do |step| puts " #{step}" end @scenario.assertions.each do |assertion| puts " #{assertion}" end puts end |
#print_story ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/forrest/scenario_runner.rb', line 39 def print_story puts "=" * 80 puts "\n- #{colorize(@story.name, :bold)} \n\n" if @faults.empty? puts " #{colorize(@scenario.name, :green)}" else puts " #{colorize(@scenario.name, :red)}" end unless @scenario.steps.empty? && @scenario.assertions.empty? print_scenario end puts "=" * 80 end |
#set_scenario ⇒ Object
23 24 25 |
# File 'lib/forrest/scenario_runner.rb', line 23 def set_scenario @scenario = @story.scenarios.find{|sc| sc.name == @scenario_name} end |
#set_story ⇒ Object
18 19 20 21 |
# File 'lib/forrest/scenario_runner.rb', line 18 def set_story s ||= Story.new @suite.name @story ||= Stories.all[@story_name.constantize] end |
#test_finished(name) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/forrest/scenario_runner.rb', line 7 def test_finished(name) @scenario_name = name.split("(")[0].gsub(/^test_/, "").humanize @story_name = name.split("(")[1].gsub(/\)$/, "") set_story set_scenario end |