Class: Appear::RunnerRecorder
- Inherits:
-
Runner
- Object
- BaseService
- Service
- Runner
- Appear::RunnerRecorder
- Defined in:
- lib/appear/runner.rb
Overview
Records every command run to a directory; intended to be useful for later integration tests.
Constant Summary collapse
- OUTPUT_DIR =
The location to write recorded runs to. Currently hard-coded to a location inside the gem’s spec folder.
MODULE_DIR.join('spec/command_output')
- INIT_AT =
the time that this class file was loaded at
Time.new
Instance Method Summary collapse
-
#initialize(*args) ⇒ RunnerRecorder
constructor
A new instance of RunnerRecorder.
- #run(command, opts = {}) ⇒ Object
Methods inherited from BaseService
delegate, require_service, required_services
Constructor Details
#initialize(*args) ⇒ RunnerRecorder
Returns a new instance of RunnerRecorder.
59 60 61 62 |
# File 'lib/appear/runner.rb', line 59 def initialize(*args) super(*args) @command_runs = Hash.new { |h, k| h[k] = [] } end |
Instance Method Details
#run(command, opts = {}) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/appear/runner.rb', line 65 def run(command, opts = {}) begin result = super(command) record_success(command, result) return result rescue ExecutionFailure => err record_error(command, err) if opts[:allow_failure] return err.output else raise err end end end |