rspec-rails lives in a complicated ecosystem. We need to run it against multiple versions of rails and multiple versions of Ruby as well. There are several tools already available to manage running against multiple versions of Ruby (e.g. rvm), and there are even some multi-rails tools (e.g. multi-rails) but we haven't found one that does exactly what we need here, so we've rolled our own.
thor rails:use 3.0.6 rake
thor rails:use task accepts any released version of rails, or either the
3-0-stable or master branches.
thor rails:use master thor rails:use 3-0-stable thor rails:use 3.0.6 thor rails:use 3.0.5 thor rails:use 3.0.4 thor rails:use 3.0.3 thor rails:use 3.0.2 thor rails:use 3.0.1 thor rails:use 3.0.0
It then does several things:
- generates a .gemfile file with the version listed. This is used internally by assorted rake tasks.
- installs the bundle using the appropriate file in the gemfiles directory ** this includes binstubs, which are stored in ./gemfiles/bin
- symlinks the gemfiles/bin directory to ./bin (in the project root) to support running bin/rspec from the project root
At any time, if you want to change rails versions, run
thor rails:use with a
new version number. To play it safe, you probably want to also run
clobber to delete all the code generated by the previous rails version.