Module: Minitest

Includes:
CheckRunOverride
Defined in:
lib/minitest/allow_plugin.rb

Defined Under Namespace

Modules: Allow, CheckRunOverride Classes: Result, Test

Class Method Summary collapse

Class Method Details

.plugin_allow_init(options) ⇒ Object

:nodoc:



163
164
165
166
167
168
169
170
171
# File 'lib/minitest/allow_plugin.rb', line 163

def self.plugin_allow_init options # :nodoc:
  if @allow || @allow_save then
    self.reporter.extend Allow
    self.reporter.allow      = @allow
    self.reporter.allow_save = @allow_save
    self.reporter.allow_seen = []
  end
  Minitest::Allow.run_only = @run_only
end

.plugin_allow_options(opts, _options) ⇒ Object

:nodoc:



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/minitest/allow_plugin.rb', line 131

def self.plugin_allow_options opts, _options # :nodoc:
  @allow = @allow_save = false
  @run_only = []

  opts.on "-c", "--check=path", String, "Run only the tests listed in the allowed file. Overwrites the current file." do |f|
    require "psych"

    @run_only = if Psych.respond_to? :safe_load_file
                  Psych.safe_load_file f, permitted_classes: [Regexp]
                else
                  Psych.load_file f
                end || []
    @allow_save = f
  end

  opts.on "-a", "--allow=path", String, "Allow listed tests to fail." do |f|
    # don't ask why I'm using this specifically:
    require "psych"

    @allow = if Psych.respond_to? :safe_load_file then
               Psych.safe_load_file f, permitted_classes: [Regexp]
             else
               Psych.load_file f
             end || []
  end

  opts.on "-A", "--save-allow=path", String, "Save failing tests." do |f|
    require "psych"
    @allow_save = f
  end
end