Class: Runyoufools::Runner
- Inherits:
-
Object
- Object
- Runyoufools::Runner
- Defined in:
- lib/runyoufools/runner.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #find_tests ⇒ Object
- #go ⇒ Object
-
#initialize(options) ⇒ Runner
constructor
A new instance of Runner.
- #message ⇒ Object
- #success ⇒ Object
Constructor Details
#initialize(options) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/runyoufools/runner.rb', line 8 def initialize( ) = @tests = [] find_tests Runyoufools.log :info, "found #{@tests.count} tests:" @tests.each do |test| puts test end exit( 0 ) if .list @results = { fail: [], pass: [] } end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
6 7 8 |
# File 'lib/runyoufools/runner.rb', line 6 def results @results end |
Instance Method Details
#find_tests ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/runyoufools/runner.rb', line 20 def find_tests Find.find('.') do |path| if .pattern.match( path ) if File.file?( path ) @tests.push( path ) end end end end |
#go ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/runyoufools/runner.rb', line 30 def go @success = true @tests.each do |testFile| test = Test.new( testFile, .retries, .command ) test.run key = test.ok ? :pass : :fail @results[ key ].push( test ) @success = @success && test.ok end end |
#message ⇒ Object
41 42 43 |
# File 'lib/runyoufools/runner.rb', line 41 def { true => 'OK', false => 'FAIL' }[ @success ] end |
#success ⇒ Object
45 46 47 |
# File 'lib/runyoufools/runner.rb', line 45 def success @success == true end |