class Attestify::Autorun
Supports autorun mode, where all tests defined will get run.
Public Class Methods
new(args = ARGV)
click to toggle source
# File lib/attestify/autorun.rb, line 9 def initialize(args = ARGV) @args = args end
Public Instance Methods
disable()
click to toggle source
# File lib/attestify/autorun.rb, line 26 def disable @disabled = true end
enable()
click to toggle source
# File lib/attestify/autorun.rb, line 30 def enable parse_options require_helper at_exit { at_exit_hook } end
reporter()
click to toggle source
# File lib/attestify/autorun.rb, line 17 def reporter @reporter ||= if options[:color] Attestify::ColorReporter.new else Attestify::Reporter.new end end
test_list()
click to toggle source
# File lib/attestify/autorun.rb, line 13 def test_list @test_list ||= Attestify::Autorun::TestList.new(dir: options[:directory]) end
Private Instance Methods
after_exec()
click to toggle source
# File lib/attestify/autorun.rb, line 73 def after_exec exit(exit_code) end
at_exit_hook()
click to toggle source
# File lib/attestify/autorun.rb, line 38 def at_exit_hook start unless @disabled end
option_parser()
click to toggle source
# File lib/attestify/autorun.rb, line 57 def option_parser # rubocop:disable Metrics/MethodLength @option_parser ||= OptionParser.new do |opts| opts.on("-d", "--directory [DIR]", "Run the tests as if from the provided DIR") do |dir| options[:directory] = dir end opts.on("-c", "--color", "Run with color") do options[:color] = true end opts.on("-C", "--no-color", "Run without color") do options[:color] = false end end end
options()
click to toggle source
# File lib/attestify/autorun.rb, line 51 def options @options ||= { color: true } end
parse_options()
click to toggle source
# File lib/attestify/autorun.rb, line 42 def parse_options option_parser.parse!(@args) end
require_helper()
click to toggle source
# File lib/attestify/autorun.rb, line 46 def require_helper return unless test_list.test_helper_file require File.realpath(test_list.test_helper_file) end