Module: Kernel

Defined in:
lib/minitest/rails/parallelize.rb,
lib/minitest/rails/capybara.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#describe(*args, &block) ⇒ Object Also known as: feature



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/minitest/rails/parallelize.rb', line 28

def describe *args, &block
  cls = describe_before_minitest_spec_constant_fix(*args, &block)
  cls_const = "Test__#{cls.name.to_s.split(/\W/).reject(&:empty?).join('_'.freeze)}"
  if block.source_location
    source_path, line_num = block.source_location
    source_path = Pathname.new(File.expand_path(source_path)).relative_path_from(Rails.root).to_s
    source_path = source_path.split(/\W/).reject(&:empty?).join("_".freeze)
    cls_const += "__#{source_path}__#{line_num}"
  end
  cls_const += "_1" while Minitest::Rails::SpecTests.const_defined? cls_const
  Minitest::Rails::SpecTests.const_set cls_const, cls
  cls
end