We'll respond shortly.
(Adapted from a thread on the RubyMine support forums)
Zeus is a self-described “language-agnostic application checkpointer for non-multithreaded applications.” As a Rails developer, you can use Zeus to keep your rails environment loaded so your tests run super fast. Spork does this job as well, but Zeus is newer/shinier and requires less explicit configuration. Zeus’ standard operating mode requires you to keep a Zeus server running (started with zeus start) to which you can issue commands (like zeus rspec).
To get Zeus installed on your system, follow the readme or this lovely post at ThoughtBot. The issue they mention with require ‘rspec/autorun’ should be fixed in the latest Zeus, but you can safely remove it from your spec_helper anyway.
In your Gemfile, add zeus:
group :test do gem 'zeus' end
Yes the Zeus manual wants you to only have one global install, but RubyMine won’t be able to see it when running tests, because it always runs them under bundler. (You’ll get a cannot load such file — zeus or zeus is not part of the bundle error.)
Add this script to your Rails project as script/rspec_runner.rb:
#!/usr/bin/env ruby # Suppress zeus' whining about how it won't use your RAILS_ENV ENV.delete('RAILS_ENV') # Zeus 0.13.2 parses options badly. RubyMine will invoke this file like this: # rspec_runner.rb spec/my_cool_file.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter # # ...but Zeus will parse those options thinking --require is meant for it, and die. # If the test file is moved to the end, it dies less. ARGV.push(ARGV.shift) # Add rspec to the beginning of the commands sent to Zeus ARGV.unshift 'rspec' require 'rubygems' require 'zeus' load Gem.bin_path('zeus', 'zeus')
In RubyMine’s ‘Edit Configurations’, under Default -> Rspec:
Check ‘Use Custom Rspec Runner Script’
Set it to [your-absolute-app-path]/script/rspec_runner.rb
When starting the Zeus server, use the following line:
env RUBYLIB=/Applications/RubyMine.app/rb/testing/patch/common:/Applications/RubyMine.app/rb/testing/patch/bdd zeus start
(I made this a script in my project called script/startzeus.)
These directories are where RubyMine keeps its favorite test formatters, and if you don’t tell Zeus about them at server load time, it may never find them. (you’ll get a cannot load such file — teamcity/spec/runner/formatter/teamcity/formatter error). If you’re not on OSX, you should replace these directories with something relevant to your system.
Now you can run a test in RubyMine just like you would normally, and it should be LIGHTNING FAST. Get it? Lightning? Zeus? You get it.