Permalink
Browse files

Restore reported run time to begin after files are loaded.

- was causing problems for spork users and others.
- closes #475.

This reverts commit fd04952, with
a couple of minor changes/additions.
  • Loading branch information...
dchelimsky committed Oct 30, 2011
1 parent 4406e9f commit 24a3ada96f858c7b881a9f504a9b8d1a19c27817
Showing with 7 additions and 3 deletions.
  1. +4 −0 Changelog.md
  2. +0 −1 lib/rspec/core.rb
  3. +3 −2 lib/rspec/core/reporter.rb
View
@@ -13,6 +13,9 @@
* Bug fixes
* Make sure the `bar` in `--tag foo:bar` makes it to DRb (Aaron Gibralter)
* Fix bug where full descriptions of groups nested 3 deep were repeated.
+ * Restore report of time to run to start after files are loaded.
+ * fixes bug where run times were cumalitive in spork
+ * fixes compatibility with time-series metrics
* Deprecations
* :alias option on `configuration.add_setting`. Use `:alias_with` on the
@@ -50,6 +53,7 @@ As of 2.7.0, you must explicity `require "rspec/autorun"` unless you use the
* Add `--no-drb` option (Iain Hecker)
* Provide more accurate run time by registering start time before code
is loaded (David Chelimsky)
+ * reverted in 2.8.0
* Rake task default pattern finds specs in symlinked dirs (Kelly Felkins)
* Rake task no longer does anything to invoke bundler since Bundler already
handles it for us. Thanks to Andre Arko for the tip.
View
@@ -1,4 +1,3 @@
-$rspec_start_time ||= Time.now
require 'rspec/core/dsl'
require 'rspec/core/extensions'
require 'rspec/core/load_path'
@@ -3,7 +3,7 @@ class Reporter
def initialize(*formatters)
@formatters = formatters
@example_count = @failure_count = @pending_count = 0
- @duration = nil
+ @duration = @start = nil
end
def report(count, seed)
@@ -31,6 +31,7 @@ def finish(seed)
alias_method :abort, :finish
def start(expected_example_count)
+ @start = Time.now
notify :start, expected_example_count
end
@@ -66,7 +67,7 @@ def example_pending(example)
end
def stop
- @duration = Time.now - $rspec_start_time
+ @duration = Time.now - @start if @start
notify :stop
end

0 comments on commit 24a3ada

Please sign in to comment.