Method: Minitest.plugin_rails_options

Defined in:
railties/lib/minitest/rails_plugin.rb

.plugin_rails_options(opts, options) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'railties/lib/minitest/rails_plugin.rb', line 68

def self.plugin_rails_options(opts, options)
  ::Rails::TestUnit::Runner.attach_before_load_options(opts)

  opts.on("-b", "--backtrace", "Show the complete backtrace") do
    options[:full_backtrace] = true
  end

  opts.on("-d", "--defer-output", "Output test failures and errors after the test run") do
    options[:output_inline] = false
  end

  opts.on("-f", "--fail-fast", "Abort test run on first failure or error") do
    options[:fail_fast] = true
  end

  opts.on("-c", "--[no-]color", "Enable color in the output") do |value|
    options[:color] = value
  end

  opts.on("--profile [COUNT]", "Enable profiling of tests and list the slowest test cases (default: 10)") do |value|
    default_count = 10

    if value.nil?
      count = default_count
    else
      count = Integer(value, exception: false)
      if count.nil?
        warn("Non integer specified as profile count, separate " \
             "your path from options with -- e.g. " \
             "`#{::Rails::TestUnitReporter.executable} --profile -- #{value}`")
        count = default_count
      end
    end

    options[:profile] = count
  end

  options[:color] = true
  options[:output_inline] = true
end