Class: Rails::TestUnit::Runner
Relationships & Source Files | |
Inherits: | Object |
Defined in: | railties/lib/rails/test_unit/runner.rb |
Class Attribute Summary
- .filters (also: #filters) readonly
Class Method Summary
Instance Attribute Summary
- #filters readonly
Class Attribute Details
.filters (readonly) Also known as: #filters
[ GitHub ]# File 'railties/lib/rails/test_unit/runner.rb', line 11
mattr_reader :filters, default: []
Class Method Details
.attach_before_load_options(opts)
[ GitHub ]# File 'railties/lib/rails/test_unit/runner.rb', line 14
def (opts) opts.on("--warnings", "-w", "Run with Ruby warnings enabled") {} opts.on("-e", "--environment ENV", "Run tests in the ENV environment") {} end
.compose_filter(runnable, filter)
[ GitHub ]# File 'railties/lib/rails/test_unit/runner.rb', line 53
def compose_filter(runnable, filter) if filters.any? { |_, lines| lines.any? } CompositeFilter.new(runnable, filter, filters) else filter end end
.load_tests(argv)
[ GitHub ]# File 'railties/lib/rails/test_unit/runner.rb', line 44
def load_tests(argv) patterns = extract_filters(argv) tests = Rake::FileList[patterns.any? ? patterns : "test/**/*_test.rb"] tests.exclude("test/system/**/*") if patterns.empty? tests.to_a.each { |path| require File. (path) } end
.parse_options(argv)
[ GitHub ]# File 'railties/lib/rails/test_unit/runner.rb', line 19
def (argv) # Perform manual parsing and cleanup since option parser raises on unknown options. env_index = argv.index("--environment") || argv.index("-e") if env_index argv.delete_at(env_index) environment = argv.delete_at(env_index).strip end ENV["RAILS_ENV"] = environment || "test" w_index = argv.index("--warnings") || argv.index("-w") $VERBOSE = argv.delete_at(w_index) if w_index end
.rake_run(argv = [])
[ GitHub ]# File 'railties/lib/rails/test_unit/runner.rb', line 32
def rake_run(argv = []) ARGV.replace Shellwords.split(ENV["TESTOPTS"] || "") run(argv) end
.run(argv = [])
[ GitHub ]# File 'railties/lib/rails/test_unit/runner.rb', line 38
def run(argv = []) load_tests(argv) require "active_support/testing/autorun" end
Instance Attribute Details
#filters (readonly)
[ GitHub ]# File 'railties/lib/rails/test_unit/runner.rb', line 11
mattr_reader :filters, default: []