[LRUG] How to test a Rails plugin gem against different versions of Rails?
Andrew Stewart
boss at airbladesoftware.com
Fri Oct 15 06:01:10 PDT 2010
On 14 Oct 2010, at 10:25, Mark Evans wrote:
> I use bundler in one of my gems to do exactly the same (test against different versions of rails).
> You can have two different gemfiles, e.g. Gemfile.rails.2.3.8 and Gemfile.rails.3.0.0, and then use the BUNDLE_GEMFILE env to specify the gemfile to use, with bundle exec, for example
>
> BUNDLE_GEMFILE=Gemfile.rails.2.3.8 bundle exec rake test
>
> Hope that helps
> Mark
>
> On 12 October 2010 13:45, Glenn Gillen <glenn at rubypond.com> wrote:
> And then be sure to use "bundler exec" before the commands to make sure you're running the expected version of rake.
Thanks everyone for the help. I decided to use Bundler to manage the dependencies and leave rvm to manage Ruby versions only.
I ended up taking the opposite approach to you, Mark. Instead of specifying dependencies in my Gemfile, I put them in the gemspec and pointed the Gemfile at that.
http://github.com/airblade/paper_trail/commit/bd1877cab0a2f3c2dc8f4bf0d5b06340ee45d984
All this has allowed me to get the tests running again against Rails 2.3. Excellent.
Rails 3 seems to need tests to be structured differently so I think I'll branch the repo: the master branch for Rails 3 and version 2.x of my gem, and a branch for Rails 2.3 and version 1.x of my gem. And then I'll only need one Gemfile in each.
Anyway, thanks again for all the tips.
Cheers,
Andy Stewart
-------
http://airbladesoftware.com
More information about the Chat
mailing list