Sha256: 6c38448c1c1a5a16c7e32e50c3f9e346adce9060ce084a7f9ffd250c6ebdf4a7

Contents?: true

Size: 898 Bytes

Versions: 5

Compression:

Stored size: 898 Bytes

Contents

require 'fileutils'
require 'pp'

module Runyoufools

class Runner
	attr_reader :results

	def initialize( options )
        @options = options
        @tests = []
        find_tests
		Runyoufools.log :info, "found #{@tests.count} tests:"
		PP.pp @tests
		@results = { fail: [], pass: [] }
	end

    def find_tests
        Find.find('.') do |path|
            if @options.pattern.match( path )
                if File.file?( path )
                    @tests.push( path )
                end
            end
        end
    end

	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

	def message
		{ true => 'OK', false => 'FAIL' }[ @success ]
	end

    def success
        @success == true
    end
end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
runyoufools-0.1.4 lib/runyoufools/runner.rb
runyoufools-0.1.3 lib/runyoufools/runner.rb
runyoufools-0.1.2 lib/runyoufools/runner.rb
runyoufools-0.1.1 lib/runyoufools/runner.rb
runyoufools-0.1.0 lib/runyoufools/runner.rb