Class: TestRun::Tests::Minitest::Wrappers::SingleTest
- Inherits:
-
Object
- Object
- TestRun::Tests::Minitest::Wrappers::SingleTest
- Defined in:
- lib/test_run/tests/minitest/wrappers/single_test.rb
Instance Method Summary collapse
- #app_root ⇒ Object
-
#initialize(file:, line:) ⇒ SingleTest
constructor
A new instance of SingleTest.
- #relative_test_path ⇒ Object
- #to_command ⇒ Object
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_root ⇒ Object
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_path ⇒ Object
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_command ⇒ Object
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 |