Skip to content

Commit

Permalink
Restore reported run time to begin after files are loaded.
Browse files Browse the repository at this point in the history
- was causing problems for spork users and others.
- closes rspec#475.

This reverts commit fd04952, with
a couple of minor changes/additions.
  • Loading branch information
dchelimsky committed Oct 30, 2011
1 parent 4406e9f commit 24a3ada
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion lib/rspec/core.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
$rspec_start_time ||= Time.now
require 'rspec/core/dsl'
require 'rspec/core/extensions'
require 'rspec/core/load_path'
Expand Down
5 changes: 3 additions & 2 deletions lib/rspec/core/reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 24a3ada

Please sign in to comment.