class TestRun::Tests::Minitest::Wrappers::SingleTest

Attributes

file[R]
name[R]

Public Class Methods

new(file:, line:) click to toggle source
# File lib/test_run/tests/minitest/wrappers/single_test.rb, line 12
def initialize(file:, line:)
  @file = file
  @name = line[/\s*def\s+(.*)/, 1]
end

Public Instance Methods

app_root() click to toggle source
# File lib/test_run/tests/minitest/wrappers/single_test.rb, line 21
def app_root
  exploded_path = Utils::Path.split(file)

  path = exploded_path[0...exploded_path.rindex("test")]
  File.join(path)
end
relative_test_path() click to toggle source
# File lib/test_run/tests/minitest/wrappers/single_test.rb, line 28
def relative_test_path
  exploded_path = Utils::Path.split(file)
  path = exploded_path[exploded_path.rindex("test")..-1]
  File.join(path)
end
to_command() click to toggle source
# File lib/test_run/tests/minitest/wrappers/single_test.rb, line 17
def to_command
  %{cd #{app_root} && ruby -I test #{relative_test_path} --name=/#{name}/}
end