Class: TestRun::Tests::Minitest::Wrappers::SingleTest

Inherits:
Object
  • Object
show all
Defined in:
lib/test_run/tests/minitest/wrappers/single_test.rb

Instance Method Summary collapse

Constructor Details

#initialize(file:, line:) ⇒ SingleTest

Returns a new instance of SingleTest.



12
13
14
15
# 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

Instance Method Details

#app_rootObject



21
22
23
24
25
26
# 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_pathObject



28
29
30
31
32
# 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_commandObject



17
18
19
# 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