1

I'm running rails 3.2.11 and ruby 1.9.3

How I implemented it: I open a terminal window and run:

spork

Here is the message I get:

Using RSpec, Rails
Preloading Rails environment
Loading Spork.prefork block...
Rack::File headers parameter replaces cache_control after Rack 1.5.
Spork is ready and listening on 8989!

I open a separate terminal and run autotest.

Autotest is still slow.(2 mn 47 seconds for 263 examples)

I am only running controller and model tests.

Here is my spec_helper:

require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
require 'spork/ext/ruby-debug'

Spork.prefork do

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

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


  config.order = "random"

  Capybara.register_driver :selenium do |app|
    Capybara::Selenium::Driver.new(app, :browser => :chrome)
  end

  Capybara.app_host = "#{FULL_ROOT}"



  def test_sign_in(user)
    session[:user_id] = user.id
  end
end


end

Spork.each_run do
  # This code will be run each time you run your specs.



end
Laurent
  • 1,554
  • 19
  • 42
  • does spork pick up anything when you try to run rspec normally without autotest? – prusswan Dec 06 '13 at 06:44
  • No it remains blank after the line "...listening on 8989!" For the life ofme I could not find online indications of what spork is supposed to say - so I was not sure what normal behavior is. – Laurent Dec 06 '13 at 06:49
  • 1
    Then probably you can take autotest out of the picture for now. Also remember to add `--drb` to the rspec command if you haven't – prusswan Dec 06 '13 at 06:55
  • 1
    2 is correct. You can do 1 as a last resort. – prusswan Dec 06 '13 at 07:02
  • 1
    related: http://stackoverflow.com/questions/4274499/how-to-combine-autotest-and-spork-in-rails-testing – prusswan Dec 06 '13 at 07:10
  • Ok the problem was the missing --drb which I added to my.rspec file. I then retained autotest. Now my issue is that autotest will run the entire test suite (every couple of tests). I need to find out what this is due to and fix it. You should put your comment about --drb as an answer - you've earned some points don't you think? – Laurent Dec 06 '13 at 08:25

0 Answers0