Method: BaseTest#r

Defined in:
lib/test/test_helper.rb

#r(action, name = :rename_replace, expected_yields = nil, options = {}) ⇒ Object



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/test/test_helper.rb', line 136

def r(action, name = :rename_replace, expected_yields = nil, options = {})
  options[:file_provider] ||= @files
  options[:action] ||= action
  options[:filter] = Filter.add options[:filter], Filter.new(/^\.+$/) unless options[:test_r_nofilter]
  yc = 0
  @r.run name, options do |h|
    yc += 1
    yield h if block_given?
  end
  if options[:test_r_count]
    raise 'exception raised' if expected_yields and expected_yields != yc
  else
    assert_equal expected_yields, yc, 'Expected yields from renamer' if expected_yields
  end
end