forrest 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +56 -0
 - data/bin/forrest +119 -0
 - data/forrest.gemspec +34 -0
 - data/lib/forrest/runner.rb +54 -0
 - data/lib/forrest/runner.rb~ +0 -0
 - data/lib/forrest/unix_console_styler.rb +40 -0
 - data/lib/object.rb +17 -0
 - data/lib/object.rb~ +0 -0
 - data/pri +3 -0
 - data/test/forest_stories_test.rb~ +0 -0
 - data/test/forrest_stories_test.rb +24 -0
 - data/test/forrest_stories_test.rb~ +12 -0
 - metadata +81 -0
 
    
        data/README.markdown
    ADDED
    
    | 
         @@ -0,0 +1,56 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Forrest the stories's runner
         
     | 
| 
      
 2 
     | 
    
         
            +
            ============================
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            Forrest is a runner for stories framework, you can run one story
         
     | 
| 
      
 5 
     | 
    
         
            +
            inside of a file that have many stories, can run one scenario
         
     | 
| 
      
 6 
     | 
    
         
            +
            or print the list of stories inside a file.
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            Print the stories/scenarios list
         
     | 
| 
      
 9 
     | 
    
         
            +
            --------------------------------
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                forrest test/forrest_stories_test.rb
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                + ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheBenchmarkForEachScenario
         
     | 
| 
      
 14 
     | 
    
         
            +
                |__ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheBenchmarkForEachScenario#test_A_user_run_forrest_with_a_StoryName_as_a_param
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                + ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat
         
     | 
| 
      
 17 
     | 
    
         
            +
                |__ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat#test_A_user_run_forrest_with_a_StoryName_as_a_param
         
     | 
| 
      
 18 
     | 
    
         
            +
                |__ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat#test_A_user_run_forrest_with_a_filepath_as_a_param
         
     | 
| 
      
 19 
     | 
    
         
            +
                Loaded suite
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            Run a particular story
         
     | 
| 
      
 22 
     | 
    
         
            +
            ----------------------
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
               ==> Runing story...
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
               Loaded suite ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat
         
     | 
| 
      
 27 
     | 
    
         
            +
               Started
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
               - As a stories user I want to see the stories report in a very nice format
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                   A user run forrest with a filepath as a param
         
     | 
| 
      
 32 
     | 
    
         
            +
                   A user run forrest with a StoryName as a param
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                Finished in 0.001404 seconds.
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                2 tests, 0 assertions, 0 failures, 0 errors
         
     | 
| 
      
 37 
     | 
    
         
            +
                1 story,  2 scenarios
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            Run a particular scenario
         
     | 
| 
      
 40 
     | 
    
         
            +
            -------------------------
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                forrest ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat#test_A_user_run_forrest_with_a_filepath_as_a_param
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                ==> Runing scenario...
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                test/forrest_stories_test
         
     | 
| 
      
 47 
     | 
    
         
            +
                Loaded suite test_A_user_run_forrest_with_a_filepath_as_a_param(ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat)
         
     | 
| 
      
 48 
     | 
    
         
            +
                Started
         
     | 
| 
      
 49 
     | 
    
         
            +
                .
         
     | 
| 
      
 50 
     | 
    
         
            +
                Finished in 0.000997 seconds.
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                1 tests, 0 assertions, 0 failures, 0 errors
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            **and have fun!**
         
     | 
    
        data/bin/forrest
    ADDED
    
    | 
         @@ -0,0 +1,119 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'ftools'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'test/unit/ui/console/testrunner'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            require File.join(File.dirname(__FILE__), '../lib/object')
         
     | 
| 
      
 7 
     | 
    
         
            +
            require File.join(File.dirname(__FILE__), '../lib/forrest/unix_console_styler')
         
     | 
| 
      
 8 
     | 
    
         
            +
            require File.join(File.dirname(__FILE__), '../lib/forrest/runner')
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            FILE_S = "%%--"
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            # --------------------------------------------------------------------------
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            def file_s
         
     | 
| 
      
 15 
     | 
    
         
            +
              colorize(FILE_S, :bold)
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            def print_test_cases(test_cases)
         
     | 
| 
      
 19 
     | 
    
         
            +
              test_cases.each{|tc|
         
     | 
| 
      
 20 
     | 
    
         
            +
                tests = tc.suite.tests
         
     | 
| 
      
 21 
     | 
    
         
            +
                puts "\n+ #{colorize(tc, :bold)}#{file_s}#{@test_file}"
         
     | 
| 
      
 22 
     | 
    
         
            +
                tests.each{|t|
         
     | 
| 
      
 23 
     | 
    
         
            +
                  puts "|__ #{colorize(tc, :cyan)}##{colorize(t.method_name, :yellow)}" +
         
     | 
| 
      
 24 
     | 
    
         
            +
                             "#{file_s}#{@test_file}\n\n"
         
     | 
| 
      
 25 
     | 
    
         
            +
                }
         
     | 
| 
      
 26 
     | 
    
         
            +
              }
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            def require_rails_env?
         
     | 
| 
      
 30 
     | 
    
         
            +
              begin
         
     | 
| 
      
 31 
     | 
    
         
            +
                require File.join(@test_dir, "../config/environment")
         
     | 
| 
      
 32 
     | 
    
         
            +
                return true
         
     | 
| 
      
 33 
     | 
    
         
            +
              rescue LoadError
         
     | 
| 
      
 34 
     | 
    
         
            +
                begin
         
     | 
| 
      
 35 
     | 
    
         
            +
                  require File.join(@test_dir, "../../config/environment")
         
     | 
| 
      
 36 
     | 
    
         
            +
                  return true
         
     | 
| 
      
 37 
     | 
    
         
            +
                rescue LoadError
         
     | 
| 
      
 38 
     | 
    
         
            +
                  return false
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            def require_active_support_or_rails_env
         
     | 
| 
      
 44 
     | 
    
         
            +
              unless require_rails_env?
         
     | 
| 
      
 45 
     | 
    
         
            +
                require 'active_support/core_ext/string/inflections'
         
     | 
| 
      
 46 
     | 
    
         
            +
                require 'active_support/core_ext/string'
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
            end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            def show
         
     | 
| 
      
 51 
     | 
    
         
            +
              @test_file  = ARGV[0]
         
     | 
| 
      
 52 
     | 
    
         
            +
              require @test_file
         
     | 
| 
      
 53 
     | 
    
         
            +
              require_active_support_or_rails_env
         
     | 
| 
      
 54 
     | 
    
         
            +
              @test_cases = test_class.subclasses
         
     | 
| 
      
 55 
     | 
    
         
            +
              print_test_cases(@test_cases)
         
     | 
| 
      
 56 
     | 
    
         
            +
              begin
         
     | 
| 
      
 57 
     | 
    
         
            +
                Test::Unit::UI::Console::TestRunner.run(nil)
         
     | 
| 
      
 58 
     | 
    
         
            +
              rescue NoMethodError
         
     | 
| 
      
 59 
     | 
    
         
            +
              end
         
     | 
| 
      
 60 
     | 
    
         
            +
            end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            def run_story
         
     | 
| 
      
 63 
     | 
    
         
            +
              require_test_file
         
     | 
| 
      
 64 
     | 
    
         
            +
              Stories::ForrestRunner.run(@test_class.constantize)
         
     | 
| 
      
 65 
     | 
    
         
            +
            end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            def run_scenario
         
     | 
| 
      
 68 
     | 
    
         
            +
              puts test_file
         
     | 
| 
      
 69 
     | 
    
         
            +
              require_test_file
         
     | 
| 
      
 70 
     | 
    
         
            +
              test = @test_class.constantize.suite.tests.find{|t|
         
     | 
| 
      
 71 
     | 
    
         
            +
                t.method_name == @test_name
         
     | 
| 
      
 72 
     | 
    
         
            +
              }
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
              Test::Unit::UI::Console::TestRunner.run(test)
         
     | 
| 
      
 75 
     | 
    
         
            +
            end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            def require_test_file
         
     | 
| 
      
 78 
     | 
    
         
            +
              begin
         
     | 
| 
      
 79 
     | 
    
         
            +
                require "test/#{test_file}"
         
     | 
| 
      
 80 
     | 
    
         
            +
              rescue LoadError
         
     | 
| 
      
 81 
     | 
    
         
            +
                require "test/stories/#{test_file}"
         
     | 
| 
      
 82 
     | 
    
         
            +
              end
         
     | 
| 
      
 83 
     | 
    
         
            +
            end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            def test_class
         
     | 
| 
      
 86 
     | 
    
         
            +
              @test_class = File.basename(@test_file, ".rb").camelize.constantize
         
     | 
| 
      
 87 
     | 
    
         
            +
            end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            def test_file
         
     | 
| 
      
 90 
     | 
    
         
            +
              @test_file  = "#{@test_class.split("::")[0].underscore}"
         
     | 
| 
      
 91 
     | 
    
         
            +
            end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
            def colorize(text, color)
         
     | 
| 
      
 94 
     | 
    
         
            +
              "#{UnixConsoleStyler::STYLE[color]}#{text}\e[0m"
         
     | 
| 
      
 95 
     | 
    
         
            +
            end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
            if File.file? ARGV[0]
         
     | 
| 
      
 98 
     | 
    
         
            +
              puts "==> Printing all stories/scenarios...\n\n"
         
     | 
| 
      
 99 
     | 
    
         
            +
              @test_dir  = File.dirname(ARGV[0])
         
     | 
| 
      
 100 
     | 
    
         
            +
              show
         
     | 
| 
      
 101 
     | 
    
         
            +
            else
         
     | 
| 
      
 102 
     | 
    
         
            +
              @test_dir  = File.join(File.dirname(ARGV[0].split("#{FILE_S}")[1]))
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
              if ARGV[0].include? "#"
         
     | 
| 
      
 105 
     | 
    
         
            +
                puts "==> Runing scenario...\n\n"
         
     | 
| 
      
 106 
     | 
    
         
            +
                @test_class = ARGV[0].split("#")[0]
         
     | 
| 
      
 107 
     | 
    
         
            +
                @test_name  = ARGV[0].split("#")[1].split("#{FILE_S}")[0]
         
     | 
| 
      
 108 
     | 
    
         
            +
                require_active_support_or_rails_env
         
     | 
| 
      
 109 
     | 
    
         
            +
                run_scenario
         
     | 
| 
      
 110 
     | 
    
         
            +
              else
         
     | 
| 
      
 111 
     | 
    
         
            +
                puts "==> Runing story...\n\n"
         
     | 
| 
      
 112 
     | 
    
         
            +
                @test_class = ARGV[0].split("#{FILE_S}")[0]
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
                require_active_support_or_rails_env
         
     | 
| 
      
 115 
     | 
    
         
            +
                run_story
         
     | 
| 
      
 116 
     | 
    
         
            +
              end
         
     | 
| 
      
 117 
     | 
    
         
            +
            end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
    
        data/forrest.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'date'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 4 
     | 
    
         
            +
              s.name              = %q{forrest}
         
     | 
| 
      
 5 
     | 
    
         
            +
              s.version           = "0.1.0"
         
     | 
| 
      
 6 
     | 
    
         
            +
              s.date              = Date.today.to_s
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.summary           = %q{Forrest is a runner for stories framework, you can run one story inside of a file that have many stories, can run one scenario or print the list of stories inside a file.}
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.description       =<<DESCRIPTION
         
     | 
| 
      
 9 
     | 
    
         
            +
            Forrest is a runner for stories framework, you can run one story
         
     | 
| 
      
 10 
     | 
    
         
            +
            inside of a file that have many stories, can run one scenario
         
     | 
| 
      
 11 
     | 
    
         
            +
            or print the list of stories inside a file.
         
     | 
| 
      
 12 
     | 
    
         
            +
            DESCRIPTION
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              s.author                = %q{Gaston Ramos}
         
     | 
| 
      
 15 
     | 
    
         
            +
              s.email                 = %q{ramos.gaston@gmail.com}
         
     | 
| 
      
 16 
     | 
    
         
            +
              s.homepage              = %q{http://github.com/gramos/forrest}
         
     | 
| 
      
 17 
     | 
    
         
            +
              s.bindir                = 'bin'
         
     | 
| 
      
 18 
     | 
    
         
            +
              s.executables           = ['forrest']
         
     | 
| 
      
 19 
     | 
    
         
            +
              s.default_executable = %q{forrest}
         
     | 
| 
      
 20 
     | 
    
         
            +
              s.require_paths         = %w{lib bin .}
         
     | 
| 
      
 21 
     | 
    
         
            +
              s.autorequire           = 'forrest'
         
     | 
| 
      
 22 
     | 
    
         
            +
              s.rubyforge_project     = %q{forrest}
         
     | 
| 
      
 23 
     | 
    
         
            +
              s.has_rdoc              = true
         
     | 
| 
      
 24 
     | 
    
         
            +
              s.required_ruby_version = '>= 1.8'
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              # s.add_dependency("rmagick", ">= 1.15.7")
         
     | 
| 
      
 27 
     | 
    
         
            +
              # s.add_dependency("OptionParser", ">= 0.5.1")
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              s.files = Dir.glob("**/*").delete_if { |item| item.include?(".git") }
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              # s.signing_key = '/home/gramos/src/ruby/ruby-sign/gem-private_key.pem'
         
     | 
| 
      
 32 
     | 
    
         
            +
              # s.cert_chain  = ['/home/gramos/src/ruby/ruby-sign/gem-public_cert.pem']
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,54 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Stories
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              class ForrestRunner < Test::Unit::UI::Console::TestRunner
         
     | 
| 
      
 4 
     | 
    
         
            +
                def test_finished(name)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  set_story
         
     | 
| 
      
 6 
     | 
    
         
            +
                end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                def add_fault(fault)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @faults << fault
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def set_story
         
     | 
| 
      
 13 
     | 
    
         
            +
                  s      ||= Story.new @suite.name
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @story ||= Stories.all[s.name.constantize]
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                def print_scenario(scenario)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  scenario.steps.each do |step|
         
     | 
| 
      
 19 
     | 
    
         
            +
                    puts "      #{step}"
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  scenario.assertions.each do |assertion|
         
     | 
| 
      
 23 
     | 
    
         
            +
                    puts "      #{assertion}"
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  puts
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                def print_story
         
     | 
| 
      
 30 
     | 
    
         
            +
                  puts "- #{colorize(@story.name, :bold)} \n\n"
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  @story.scenarios.each do |scenario|
         
     | 
| 
      
 33 
     | 
    
         
            +
                    puts "    #{scenario.name}"
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                    unless scenario.steps.empty? && scenario.assertions.empty?
         
     | 
| 
      
 36 
     | 
    
         
            +
                      print_scenario scenario
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                def finished(elapsed_time)
         
     | 
| 
      
 42 
     | 
    
         
            +
                  puts
         
     | 
| 
      
 43 
     | 
    
         
            +
                  print_story
         
     | 
| 
      
 44 
     | 
    
         
            +
                  super
         
     | 
| 
      
 45 
     | 
    
         
            +
                  stories_count   = 1
         
     | 
| 
      
 46 
     | 
    
         
            +
                  scenarios_count = @story.scenarios.size
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                  puts colorize("#{stories_count} story, ", :bold) +
         
     | 
| 
      
 49 
     | 
    
         
            +
                       colorize(" #{scenarios_count} scenarios", :bold)
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            end
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module UnixConsoleStyler
         
     | 
| 
      
 2 
     | 
    
         
            +
              class StyleNotFoundException < Exception; end
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
              # Availables Styles
         
     | 
| 
      
 5 
     | 
    
         
            +
              STYLE = {
         
     | 
| 
      
 6 
     | 
    
         
            +
                  :default    =>    "\033[0m",
         
     | 
| 
      
 7 
     | 
    
         
            +
                  # styles
         
     | 
| 
      
 8 
     | 
    
         
            +
                  :bold       =>    "\033[1m",
         
     | 
| 
      
 9 
     | 
    
         
            +
                  :underline  =>    "\033[4m",
         
     | 
| 
      
 10 
     | 
    
         
            +
                  :blink      =>    "\033[5m",
         
     | 
| 
      
 11 
     | 
    
         
            +
                  :reverse    =>    "\033[7m",
         
     | 
| 
      
 12 
     | 
    
         
            +
                  :concealed  =>    "\033[8m",
         
     | 
| 
      
 13 
     | 
    
         
            +
                  # font colors
         
     | 
| 
      
 14 
     | 
    
         
            +
                  :black      =>    "\033[30m",
         
     | 
| 
      
 15 
     | 
    
         
            +
                  :red        =>    "\033[31m",
         
     | 
| 
      
 16 
     | 
    
         
            +
                  :green      =>    "\033[32m",
         
     | 
| 
      
 17 
     | 
    
         
            +
                  :yellow     =>    "\033[33m",
         
     | 
| 
      
 18 
     | 
    
         
            +
                  :blue       =>    "\033[34m",
         
     | 
| 
      
 19 
     | 
    
         
            +
                  :magenta    =>    "\033[35m",
         
     | 
| 
      
 20 
     | 
    
         
            +
                  :cyan       =>    "\033[36m",
         
     | 
| 
      
 21 
     | 
    
         
            +
                  :white      =>    "\033[37m",
         
     | 
| 
      
 22 
     | 
    
         
            +
                  # background colors
         
     | 
| 
      
 23 
     | 
    
         
            +
                  :on_black   =>    "\033[40m",
         
     | 
| 
      
 24 
     | 
    
         
            +
                  :on_red     =>    "\033[41m",
         
     | 
| 
      
 25 
     | 
    
         
            +
                  :on_green   =>    "\033[42m",
         
     | 
| 
      
 26 
     | 
    
         
            +
                  :on_yellow  =>    "\033[43m",
         
     | 
| 
      
 27 
     | 
    
         
            +
                  :on_blue    =>    "\033[44m",
         
     | 
| 
      
 28 
     | 
    
         
            +
                  :on_magenta =>    "\033[45m",
         
     | 
| 
      
 29 
     | 
    
         
            +
                  :on_cyan    =>    "\033[46m",
         
     | 
| 
      
 30 
     | 
    
         
            +
                  :on_white   =>    "\033[47m" }
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              # Methods to use if you want to apply a style
         
     | 
| 
      
 33 
     | 
    
         
            +
              def UnixConsoleStyler::apply_style(style)
         
     | 
| 
      
 34 
     | 
    
         
            +
                if STYLE.has_key? style
         
     | 
| 
      
 35 
     | 
    
         
            +
                  STYLE[style]
         
     | 
| 
      
 36 
     | 
    
         
            +
                else
         
     | 
| 
      
 37 
     | 
    
         
            +
                  raise StyleNotFoundException, "Style #{style} not found"
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/object.rb
    ADDED
    
    | 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Object
         
     | 
| 
      
 2 
     | 
    
         
            +
              def self.subclasses(direct = false)
         
     | 
| 
      
 3 
     | 
    
         
            +
                classes = []
         
     | 
| 
      
 4 
     | 
    
         
            +
                if direct
         
     | 
| 
      
 5 
     | 
    
         
            +
                  ObjectSpace.each_object(Class) do |c|
         
     | 
| 
      
 6 
     | 
    
         
            +
                    next unless c.superclass == self
         
     | 
| 
      
 7 
     | 
    
         
            +
                    classes << c
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
                else
         
     | 
| 
      
 10 
     | 
    
         
            +
                  ObjectSpace.each_object(Class) do |c|
         
     | 
| 
      
 11 
     | 
    
         
            +
                    next unless c.ancestors.include?(self) and (c != self)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    classes << c
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
                classes
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/object.rb~
    ADDED
    
    | 
         
            File without changes
         
     | 
    
        data/pri
    ADDED
    
    
| 
         
            File without changes
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'action_controller'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'stories'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'stories/runner'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class ForrestStoriesTest < ActionController::IntegrationTest
         
     | 
| 
      
 7 
     | 
    
         
            +
              story "As a stories user I want to see the stories report " +
         
     | 
| 
      
 8 
     | 
    
         
            +
                     "in a very nice format" do
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                scenario "A user run forrest with a filepath as a param" do
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                scenario "A user run forrest with a StoryName as a param" do
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              story "As a stories user I want to see the benchmark for each scenario" do
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                scenario "A user run forrest with a StoryName as a param" do
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,81 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: forrest
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 5 
     | 
    
         
            +
              segments: 
         
     | 
| 
      
 6 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 10 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 11 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Gaston Ramos
         
     | 
| 
      
 13 
     | 
    
         
            +
            autorequire: forrest
         
     | 
| 
      
 14 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 15 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2010-03-14 00:00:00 -03:00
         
     | 
| 
      
 18 
     | 
    
         
            +
            default_executable: forrest
         
     | 
| 
      
 19 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            description: |
         
     | 
| 
      
 22 
     | 
    
         
            +
              Forrest is a runner for stories framework, you can run one story
         
     | 
| 
      
 23 
     | 
    
         
            +
              inside of a file that have many stories, can run one scenario
         
     | 
| 
      
 24 
     | 
    
         
            +
              or print the list of stories inside a file.
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            email: ramos.gaston@gmail.com
         
     | 
| 
      
 27 
     | 
    
         
            +
            executables: 
         
     | 
| 
      
 28 
     | 
    
         
            +
            - forrest
         
     | 
| 
      
 29 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 34 
     | 
    
         
            +
            - test/forrest_stories_test.rb~
         
     | 
| 
      
 35 
     | 
    
         
            +
            - test/forest_stories_test.rb~
         
     | 
| 
      
 36 
     | 
    
         
            +
            - test/forrest_stories_test.rb
         
     | 
| 
      
 37 
     | 
    
         
            +
            - README.markdown
         
     | 
| 
      
 38 
     | 
    
         
            +
            - forrest.gemspec
         
     | 
| 
      
 39 
     | 
    
         
            +
            - bin/forrest
         
     | 
| 
      
 40 
     | 
    
         
            +
            - pri
         
     | 
| 
      
 41 
     | 
    
         
            +
            - forrest-0.1.0.gem
         
     | 
| 
      
 42 
     | 
    
         
            +
            - lib/forrest/runner.rb
         
     | 
| 
      
 43 
     | 
    
         
            +
            - lib/forrest/unix_console_styler.rb
         
     | 
| 
      
 44 
     | 
    
         
            +
            - lib/forrest/runner.rb~
         
     | 
| 
      
 45 
     | 
    
         
            +
            - lib/object.rb
         
     | 
| 
      
 46 
     | 
    
         
            +
            - lib/object.rb~
         
     | 
| 
      
 47 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 48 
     | 
    
         
            +
            homepage: http://github.com/gramos/forrest
         
     | 
| 
      
 49 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 52 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 55 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 56 
     | 
    
         
            +
            - bin
         
     | 
| 
      
 57 
     | 
    
         
            +
            - .
         
     | 
| 
      
 58 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 59 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 60 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 61 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 62 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 63 
     | 
    
         
            +
                  - 1
         
     | 
| 
      
 64 
     | 
    
         
            +
                  - 8
         
     | 
| 
      
 65 
     | 
    
         
            +
                  version: "1.8"
         
     | 
| 
      
 66 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 67 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 68 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 69 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 70 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 71 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 72 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 73 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            rubyforge_project: forrest
         
     | 
| 
      
 76 
     | 
    
         
            +
            rubygems_version: 1.3.6
         
     | 
| 
      
 77 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 78 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 79 
     | 
    
         
            +
            summary: Forrest is a runner for stories framework, you can run one story inside of a file that have many stories, can run one scenario or print the list of stories inside a file.
         
     | 
| 
      
 80 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     |