Skip to content

Instantly share code, notes, and snippets.

@deathbob
Created May 7, 2009 15:19
Show Gist options
  • Save deathbob/108155 to your computer and use it in GitHub Desktop.
Save deathbob/108155 to your computer and use it in GitHub Desktop.
What is a gist? I dunno but maybe it's like a blog.
Getting rspec set up for my latest project here at INM United. The following applies only to a brand new project, not an upgrade or retrofitting of rspec. Altho it may apply to them too, I just don't know.
required reading -
http://blog.davidchelimsky.net/2007/05/14/an-introduction-to-rspec-part-i/
gem install rspec
gem install rspec-rails
to generate the rspec stuff, cd to your project directory and
script/generate rspec
then generate your test database
RAILS_ENV=test rake db:create
now
rake spec
should work! (assuming you've created /spec/models/xxx_spec.rb )
At the top of that file you need to include the spec helper file script/generate rspec generated. (why is this not work out the box?) probably because i didn't script/generate rspec_model ...
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
I tried
require 'user'
but that didn't work.
rspactor doesn't work with the latest release of rspec, so I am using the builtin thingie autospec.
do the stuff here http://wiki.github.com/dchelimsky/rspec/spec_server-autospec-nearly-pure-bdd-joy which is a few minimal modifications to your test environment
(you'll need to install zentest, which isn't mentioned above)
gem install ZenTest
and you're off.
rake spec:server:start
script/autospec
no growl integration? Boo! Ah well. I'm sure there's lots i've left out and more i need to learn but hopefully this will be enough to get me started next time i have to roll rspec out on a greenfield project :D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment