Class: RailsProof::TestRunner
- Inherits:
-
Object
- Object
- RailsProof::TestRunner
- Defined in:
- lib/rails_proof/test_runner.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#test_file_path ⇒ Object
readonly
Returns the value of attribute test_file_path.
Instance Method Summary collapse
- #command ⇒ Object
-
#initialize(root:, test_file_path:) ⇒ TestRunner
constructor
A new instance of TestRunner.
- #run ⇒ Object
- #working_directory ⇒ Object
Constructor Details
#initialize(root:, test_file_path:) ⇒ TestRunner
Returns a new instance of TestRunner.
21 22 23 24 |
# File 'lib/rails_proof/test_runner.rb', line 21 def initialize(root:, test_file_path:) @root = Pathname.new(root). @test_file_path = Pathname.new(test_file_path) end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
19 20 21 |
# File 'lib/rails_proof/test_runner.rb', line 19 def root @root end |
#test_file_path ⇒ Object (readonly)
Returns the value of attribute test_file_path.
19 20 21 |
# File 'lib/rails_proof/test_runner.rb', line 19 def test_file_path @test_file_path end |
Instance Method Details
#command ⇒ Object
44 45 46 |
# File 'lib/rails_proof/test_runner.rb', line 44 def command @command ||= resolve_runner.fetch(:command) end |
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rails_proof/test_runner.rb', line 26 def run stdout, stderr, status = Open3.capture3( { "RAILS_ENV" => "test" }, *command, chdir: working_directory.to_s ) output = [stdout, stderr].reject(&:empty?).join raise_unavailable_test_api!(output) Result.new( passed: status.success?, output: output, command: command ) end |
#working_directory ⇒ Object
48 49 50 |
# File 'lib/rails_proof/test_runner.rb', line 48 def working_directory @working_directory ||= resolve_runner.fetch(:working_directory) end |