2

When running rspec tests on my rails app using "rake" or "rake spec", it takes a long time to initialize Rails and start running tests.

Is there a way to keep Rails loaded in memory and run tests against it? I'm hoping there's something similar to using "grails interactive" like this How to speed up grails test execution but for Rails.

Community
  • 1
  • 1
Nathan Hurst
  • 1,740
  • 14
  • 22

3 Answers3

5

It's almost what Spork is all about.

apneadiving
  • 114,565
  • 26
  • 219
  • 213
  • Thanks! I've got spork running with in my Rails 3 development environment now. Looks like things will be much quicker when I'm ready for continuous integration too. – Nathan Hurst Jul 28 '11 at 18:28
2

See the most awesome railscast "How I test" http://railscasts.com/episodes/275-how-i-test This uses guard to run a relevant test every time you save a file so you know almost instantly if the code you have written has caused a pass or a fail. Also if you are running on linux then you can use the libnotify and libnotify-rails gems which pop up a window for you (totally unobtrusively) indicating a pass or failure so you don't have to keep checking the console.

jamesc
  • 12,423
  • 15
  • 74
  • 113
1

There is a Railscast called Spork that specifically discusses this problem at http://railscasts.com/episodes/285-spork and offers an excellent solution with a detailed walkthrough.

SnapShot
  • 5,464
  • 5
  • 42
  • 40