[rspec-users] How do I isolation test against different gem versions?

David Chelimsky dchelimsky at gmail.com
Sun May 23 15:18:39 EDT 2010


On May 23, 2010, at 12:55 PM, Brian Cardarella wrote:

> Rick,
> 
>   Cool, this looks like it should work. My original approach was to
> find something that would work under autospec but I think that might
> be getting too greedy in this case.

You could hook that up if you want to. Just need clear out the rspec mappings and replace them with  your own - then you could have a conditional based on a command line param.

I've got a few blog posts on configuring autotest: http://blog.davidchelimsky.net/?s=autotest

HTH,
David

> Thank-you!
> 
> - Brian
> 
> On May 23, 12:54 pm, Rick DeNatale <rick.denat... at gmail.com> wrote:
>> On Sun, May 23, 2010 at 11:41 AM, Brian Cardarella
>> 
>> <bcardare... at gmail.com> wrote:
>>> I would like to support both ActiveRecord 2.x and ActiveModel 3.x for
>>> a given library. It is not clear to me how to write tests for this. If
>>> I require 'active_record' then all of the dependencies are also loaded
>>> and are now in the load path as well as the Gem loaded list.
>>> Considering that AR and AM share dependencies but of different
>>> versions conflicts occur.
>> 
>>> Is this possible? The difference in code is not enough to warrant
>>> breaking into separate gems.
>> 
>> I do something similar for RiCal, which works using either
>> activesupport or the tzinfo gem.  I've set up rake tasks to run the
>> specs with either one.
>> 
>> What I do is to have an auxiliary ruby file to do the right require
>> which the spec task invokes via the -r option.
>> 
>> You should be able to do something similar by having the auxiliary
>> files use the gem directive to specify a particular version of
>> active_record.
>> 
>> Have a look athttp://github.com/rubyredrick/ri_cal/tree/master/tasks/
>> 
>> Particularly spec.rake and the files in the gem_loader sub directory.
>> 
>> HTH
>> 
>> --
>> Rick DeNatale
>> 
>> Blog:http://talklikeaduck.denhaven2.com/
>> Github:http://github.com/rubyredrick
>> Twitter: @RickDeNatale
>> WWR:http://www.workingwithrails.com/person/9021-rick-denatale
>> LinkedIn:http://www.linkedin.com/in/rickdenatale
>> _______________________________________________
>> rspec-users mailing list
>> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
>> 
>> --
>> You received this message because you are subscribed to the Google Groups "rspec" group.
>> To post to this group, send email to rspec at googlegroups.com.
>> To unsubscribe from this group, send email to rspec+unsubscribe at googlegroups.com.
>> For more options, visit this group athttp://groups.google.com/group/rspec?hl=en.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list