Questions tagged [spork]

A DRb server for testing frameworks (RSpec / Cucumber currently) that forks before each run to ensure a clean testing state.

Spork is Tim Harper’s implementation of test server (similar to the script/spec_server that used to be provided by rspec-rails), except rather than using the Rails constant unloading to reload your files, it forks a copy of the server each time you run your tests. The result? Spork runs more solid: it doesn’t get corrupted over time, it can work with any ruby framework, and it properly handles modules and any voodoo meta programming you may have put in your app.

Spork runs on POSIX systems using fork. It also runs on windows by pre-populating a pool of ready processes (referred to here as the “magazine” strategy).

250 questions
6
votes
4 answers

Rails project using spork - always have to use spork?

If I am using spork in my rails project and have a spec_helper.rb file like this require 'spork' Spork.prefork do ... end Spork.each_run do ... end Does it mean I need to ALWAYS have spork running when I run my specs via rspec spec ? Meaning,…
Brand
  • 1,589
  • 1
  • 21
  • 32
6
votes
1 answer

How to use Rails.vim and spork?

If I'm in a rails project, editing with rails.vim, how can I get :Rake to run the specs through Spork? Its largely just a matter of making :Rake aware of the project's specs/spec.opts file via the "-o" flag?
Matt Darby
  • 6,224
  • 4
  • 24
  • 33
6
votes
2 answers

'script/console test' with spork and rspec not loading the whole environment?

I'm trying to load up console to interact with some of my rspec mocking helpers. I expected that running script/console test would load an env similar to when I run spec. However, this doesn't appear to be the case. It looks like spec_helper is…
Dane O'Connor
  • 67,996
  • 36
  • 114
  • 164
6
votes
2 answers

(Rails) PaperTrail and RSpec

I'm having trouble with PaperTrail (auto-versioning of objects for Rails) being used with RSpec tests. Normally I want my tests to run without PaperTrail versioning, but there are a handful of tests for which I want PaperTrail turned on. I typically…
JacobEvelyn
  • 3,443
  • 1
  • 36
  • 47
6
votes
3 answers

How to include routing in ApplicationHelper Spec when running trough Spork?

I have an rspec spec: require "spec_helper" describe ApplicationHelper do describe "#link_to_cart" do it 'should be a link to the cart' do helper.link_to_cart.should match /.*href="\/cart".*/ end end end And the…
berkes
  • 25,081
  • 21
  • 107
  • 188
6
votes
2 answers

Rspec extremely slow

My rspec tests seem to run extremely slow even with guard & spork. Finished in 5.36 seconds 13 examples, 2 failures I understand that there are several things I can do to optimize my tests & reduce interaction with the database, but I strongly…
6
votes
1 answer

cucumber working fine without spork, but spork giving me "uninitialized constant Cucumber::Rails"

I've got existing rspecs and cucumber features all running fine. I'm installing spork (spork-rails in fact) to give me some re-run speed up. I've got rspec running fine with spork. I've just modified the env.rb as per instructions (very similar to…
Tim Diggins
  • 4,016
  • 3
  • 28
  • 40
6
votes
2 answers

Why does guard start spork both for rspec and cucumber even if I wanted to start it only for rspec using groups?

In my Gemfile... group :development, :test do gem 'capybara', "1.1.2" gem 'database_cleaner', "0.7.0" gem 'cucumber', "1.1.2" gem 'cucumber-rails', "1.2.0" gem 'rspec-rails', "2.7.0" gem 'spork', "0.9.0.rc9" gem 'launchy' #launches…
Rupert
  • 343
  • 2
  • 4
  • 13
5
votes
1 answer

Spork causing undefined method error in my Rails app?

I have a standard Rails 3.2 app with some weird behavior going on. I can run rspec spec/ without spork running and all tests pass no problem. Then I fire up spork and run the specs again. This time, every test that touches one of my mailers will…
David Tuite
  • 20,708
  • 23
  • 93
  • 167
5
votes
2 answers

Guard crashing Spork when using guard-spork

I've followd the "How I Test" screencast at RailsCasts, however I ran into a problem with spork $ guard Guard is now watching at '/Users/darth/projects/auth-before' Starting Spork for Test::Unit & RSpec Couldn't find a supported test framework that…
Jakub Arnold
  • 79,807
  • 86
  • 218
  • 314
5
votes
2 answers

Rails: Cucumber not cleaning DB

I'm having some issues with cucumber & database transactions - specifically, when I run the test suite, database transactions are not cleaned afterwards. I'm running rails 3.1 with spork, postgres. Initially features/support/env.rb was set to use…
PlankTon
  • 11,872
  • 14
  • 82
  • 144
5
votes
2 answers

Factory Girl Associations with Spork Discrepancy

I'm trying to use Factory Girl for RSpec with Spork. Whenever I run my tests without spork, everything passes, but when I run it with Spork, all the tests that try to create an instance of a factory that depends on another factory, fail. For…
Justin
  • 3,544
  • 2
  • 11
  • 15
5
votes
2 answers

How to make Spork load locales and factories?

So on a Rails 3.0.9 app I'm using Spork/Guard/RSpec/FactoryGirl on 1.9.2. I would like to know how can I get Spork/Guard to automatically update my factories and locales.
fivetwentysix
  • 6,999
  • 8
  • 37
  • 57
5
votes
2 answers

Zentest - How to stop automatic testing when red

I am trying to configure autotest so that when I run my test suite and I have a failing test, autotest stops testing and waits for me to make a change before testing again. With my current configuration autotest keeps testing indefinetly when it…
Chris Knadler
  • 2,761
  • 2
  • 23
  • 32
5
votes
2 answers

Spork Capybara, config.cache_classes conflict

I'm trying to setup Spork and Capybara with TestUnit, and am running into a test.rb config problem. The issue is that Spork requires that config.cache_classes be set to false, so that changes in the model can be reflected when running tests…
joeellis
  • 2,665
  • 7
  • 26
  • 43
1 2
3
16 17