Skip to content

Timer not resetting between runs #151

murdoch opened this Issue Oct 18, 2011 · 2 comments

2 participants

murdoch commented Oct 18, 2011

From reading other recent issues, I know you're busy Tim but I've run into a small issue with spork and thought I'd better log it.

Using spork 0.9.0.rc9, I've noticed that the timer which displays how long specs are taking to run is not resetting itself between runs and is instead outputting the total time that has accumulated since the spork server was started.

Steps to reproduce:

  1. start spork from console with command spork
  2. in another window run rspec . --drb
  3. observe that specs take X seconds to run and that console output verifies this
  4. wait 60 seconds, modify a controller spec, and repeat step 2
  5. observe that specs take about Y seconds to run, but console output claims that they took (X + Y + 60) seconds.
  6. wait 10 minutes, repeat step 2
  7. observe that specs run in Z seconds but console output puts the figure at (X + Y + Z + 600) seconds

My spec_helper is just the standard one that rspec-rails generates for you and I've put everything inside the spork prefork block as follows:

require 'rubygems'
require 'spork'

Spork.prefork do
  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'
  require 'rspec/autorun'

  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

  RSpec.configure do |config|  
    config.fixture_path = "#{::Rails.root}/spec/fixtures"
    config.use_transactional_fixtures = true
    config.infer_base_class_for_anonymous_controllers = false

Like I said, i know you're busy and this isn't exactly a show-stopper but I thought I'd better log it. Perhaps it's just something I'm doing wrong.


Same here.

murdoch commented Oct 18, 2011

I'm closing the issue as it's a known rspec issue: It's been bugged on rspec-core and also on guard-rspec

The temporary fix, which may not work with future versions of rspec, is as follows:

Spork.each_run do
  # you are advised that this may break in future versions of rspec
  $rspec_start_time =  
@murdoch murdoch closed this Oct 18, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.