Class: Specwrk::CompletedStore
- Defined in:
- lib/specwrk/store/completed_store.rb
Instance Method Summary collapse
Methods inherited from Store
#[], #[]=, adapter_klass, #any?, #clear, #delete, #empty?, #initialize, #inspect, #keys, #length, #merge!, #multi_read, #reload, #to_h, with_lock
Constructor Details
This class inherits a constructor from Specwrk::Store
Instance Method Details
#dump ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/specwrk/store/completed_store.rb', line 8 def dump @run_times = [] @first_started_at = Time.new(2999, 1, 1, 0, 0, 0) # TODO: Make future proof /s @last_finished_at = Time.new(1900, 1, 1, 0, 0, 0) @output = { file_totals: Hash.new { |h, filename| h[filename] = 0.0 }, meta: {failures: 0, passes: 0, pending: 0}, examples: {} } to_h.values.each { |example| calculate(example) } @output[:meta][:total_run_time] = @run_times.sum @output[:meta][:average_run_time] = @output[:meta][:total_run_time] / [@run_times.length, 1].max.to_f @output[:meta][:first_started_at] = @first_started_at.iso8601(6) @output[:meta][:last_finished_at] = @last_finished_at.iso8601(6) @output end |