Class: Rfc::Rif
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- Rfc::Rif
- Defined in:
- lib/rfc/rif.rb
Class Attribute Summary collapse
-
.heartbeat_interval ⇒ Object
Returns the value of attribute heartbeat_interval.
Instance Attribute Summary collapse
-
#completed_count ⇒ Object
readonly
Returns the value of attribute completed_count.
-
#failed_count ⇒ Object
readonly
Returns the value of attribute failed_count.
-
#passed_count ⇒ Object
readonly
Returns the value of attribute passed_count.
-
#total_count ⇒ Object
readonly
Returns the value of attribute total_count.
Instance Method Summary collapse
- #dump_failures(notification) ⇒ Object
- #example_failed(notification) ⇒ Object
- #example_passed(_notification) ⇒ Object
- #example_pending(notification) ⇒ Object
- #report_progress ⇒ Object
- #start(notification) ⇒ Object
Class Attribute Details
.heartbeat_interval ⇒ Object
Returns the value of attribute heartbeat_interval.
13 14 15 |
# File 'lib/rfc/rif.rb', line 13 def heartbeat_interval @heartbeat_interval end |
Instance Attribute Details
#completed_count ⇒ Object (readonly)
Returns the value of attribute completed_count.
10 11 12 |
# File 'lib/rfc/rif.rb', line 10 def completed_count @completed_count end |
#failed_count ⇒ Object (readonly)
Returns the value of attribute failed_count.
10 11 12 |
# File 'lib/rfc/rif.rb', line 10 def failed_count @failed_count end |
#passed_count ⇒ Object (readonly)
Returns the value of attribute passed_count.
10 11 12 |
# File 'lib/rfc/rif.rb', line 10 def passed_count @passed_count end |
#total_count ⇒ Object (readonly)
Returns the value of attribute total_count.
10 11 12 |
# File 'lib/rfc/rif.rb', line 10 def total_count @total_count end |
Instance Method Details
#dump_failures(notification) ⇒ Object
71 72 |
# File 'lib/rfc/rif.rb', line 71 def dump_failures(notification) end |
#example_failed(notification) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/rfc/rif.rb', line 43 def example_failed(notification) @failed_count += 1 @completed_count += 1 output.puts notification.fully_formatted(failed_count) output.puts end |
#example_passed(_notification) ⇒ Object
31 32 33 34 35 |
# File 'lib/rfc/rif.rb', line 31 def example_passed(_notification) @passed_count += 1 @completed_count += 1 report_progress end |
#example_pending(notification) ⇒ Object
37 38 39 40 41 |
# File 'lib/rfc/rif.rb', line 37 def example_pending(notification) @pending_count += 1 @completed_count += 1 report_progress end |
#report_progress ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/rfc/rif.rb', line 51 def report_progress this_percent = @completed_count * 100 / total_count if @reported_percent != this_percent || @reported_at.nil? || Time.now-@reported_at > self.class.heartbeat_interval then progress_msg = %Q`\ #{Time.now.strftime('[%Y-%m-%d %H:%M:%S %z]')} \ #{this_percent}% (#{@completed_count}/#{@total_count} examples) complete` if @pending_count > 0 progress_msg += ", #{@pending_count} pending" end if @failed_count > 0 progress_msg += ", #{@failed_count} failed" end output.puts progress_msg @reported_percent = this_percent @reported_at = Time.now end end |
#start(notification) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rfc/rif.rb', line 17 def start(notification) @total_count = notification.count @passed_count = 0 @pending_count = 0 @failed_count = 0 @completed_count = 0 @this_percent = 0 @started_at = Time.now # There is no progress at this point but report the total number of # examples prior to running any of them report_progress end |