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.
9 10 11 12 13 14 15 16 |
# File 'lib/runyoufools/runner.rb', line 9 def initialize( ) @options = @tests = [] find_tests Runyoufools.log :info, "found #{@tests.count} tests:" PP.pp @tests @results = { fail: [], pass: [] } end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
7 8 9 |
# File 'lib/runyoufools/runner.rb', line 7 def results @results end |
Instance Method Details
#find_tests ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/runyoufools/runner.rb', line 18 def find_tests Find.find('.') do |path| if @options.pattern.match( path ) if File.file?( path ) @tests.push( path ) end end end end |
#go ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/runyoufools/runner.rb', line 28 def go @success = true @tests.each do |testFile| test = Test.new( testFile, @options.retries, @options.command ) test.run key = test.ok ? :pass : :fail @results[ key ].push( test ) @success = @success && test.ok end end |
#message ⇒ Object
39 40 41 |
# File 'lib/runyoufools/runner.rb', line 39 def { true => 'OK', false => 'FAIL' }[ @success ] end |
#success ⇒ Object
43 44 45 |
# File 'lib/runyoufools/runner.rb', line 43 def success @success == true end |