Test a gem in multiple versions of Rails
Plugins (and gems) are typically tested using a complete sample rails application that lives in the
spec folder of the plugin. If your gem is supposed to work with multiple versions of Rails, you might want to use to separate apps - one for each rails version.
spec_helper.rband Rails apps in e.g.
- The Rails apps share models, controllers (
app/*) and migrations (
db/*) with symlinks to
spec/shared/app_root. The symlinks are checked into Git.
- An own
Gemfilefor each Rails app, which freezes the correct versions of Rails and RSpec and referencing the gem itself.
- Shared specs live in
Rakefilein the project root that lets you run bundler (
rake all:bundle) or specs (
rake all:spec) on all projects, which pretty colored output.