On Sun, Sep 28, 2008 at 6:54 PM, Ashley Moran <[EMAIL PROTECTED]> wrote: > Hi > > I've been using the Twitter gem, but I discovered it loads ActiveSupport, > which meddles with Kernel#require and generally causes me confusion and > pain. I don't need Twitter loaded for my specs, currently I'm doing this: > > require 'twitter' unless Object.const_defined?(:Spec) > > Is there a better way?
Depends on where that is. If it's in a high level conf file, then it's probably the best you can do. If it's lower down, you *could* set up an ENV variable instead and use that as your conditional. Have it default to true, but have your spec config set it to false. Still kinda ugly :) > This got me thinking... in general, should it matter whether you load the > whole app and dependent libraries for specs? Is a spec any less isolated if > you load the whole app vs just the class the spec relates to? In theory it should be fine, but when you're running a suite of examples you're going to eventually want to load up everything in the app, no? > The one advantage I know of is if the whole app is available, you can > mock(My::Class) and it'll tell you if you're mocking something that doesn't > exist. That's good, right? RSpec's mocks don't do that (tell you when a mocked method doesn't really exist). Are you using a mocking frawework that does? > > Thanks > > Ashley > > -- > http://www.patchspace.co.uk/ > http://aviewfromafar.net/ > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users