Class: RspecN::Runner
- Inherits:
-
Cri::CommandRunner
- Object
- Cri::CommandRunner
- RspecN::Runner
- Defined in:
- lib/rspec_n/runner.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#iterations ⇒ Object
readonly
Returns the value of attribute iterations.
-
#runs ⇒ Object
readonly
Returns the value of attribute runs.
Instance Method Summary collapse
- #avg_duration_seconds ⇒ Object
-
#initialize(options, args) ⇒ Runner
constructor
A new instance of Runner.
- #start ⇒ Object
- #total_duration_seconds ⇒ Object
- #total_failed ⇒ Object
- #total_passed ⇒ Object
- #total_skipped ⇒ Object
Constructor Details
#initialize(options, args) ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 9 10 11 12 |
# File 'lib/rspec_n/runner.rb', line 5 def initialize(, args) @input = Input.new(, args) @iterations = @input.iterations @command = @input.command @display_formatter = Formatters::TableFormatter.new(runner: self) @file_formatter = Formatters::FileFormatter.new(runner: self) initialize_runs end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/rspec_n/runner.rb', line 3 def command @command end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
3 4 5 |
# File 'lib/rspec_n/runner.rb', line 3 def input @input end |
#iterations ⇒ Object (readonly)
Returns the value of attribute iterations.
3 4 5 |
# File 'lib/rspec_n/runner.rb', line 3 def iterations @iterations end |
#runs ⇒ Object (readonly)
Returns the value of attribute runs.
3 4 5 |
# File 'lib/rspec_n/runner.rb', line 3 def runs @runs end |
Instance Method Details
#avg_duration_seconds ⇒ Object
23 24 25 |
# File 'lib/rspec_n/runner.rb', line 23 def avg_duration_seconds (total_duration_seconds / @iterations).floor end |
#start ⇒ Object
14 15 16 17 |
# File 'lib/rspec_n/runner.rb', line 14 def start display_intro @display_formatter.observe { run_tests } end |
#total_duration_seconds ⇒ Object
19 20 21 |
# File 'lib/rspec_n/runner.rb', line 19 def total_duration_seconds @runs.values.inject(0) { |sum, run| sum + run.duration_seconds } end |
#total_failed ⇒ Object
31 32 33 |
# File 'lib/rspec_n/runner.rb', line 31 def total_failed @runs.values.count(&:failed?) end |
#total_passed ⇒ Object
27 28 29 |
# File 'lib/rspec_n/runner.rb', line 27 def total_passed @runs.values.count(&:passed?) end |
#total_skipped ⇒ Object
35 36 37 |
# File 'lib/rspec_n/runner.rb', line 35 def total_skipped @runs.values.count(&:skipped?) end |