[rspec-users] Gem conflict with RSpec::Rails and Sunspot

Shane Mingins elc at mingins.com
Sun Jul 18 21:21:59 EDT 2010

Seems to be related to the line 'tests Class.new(ActionController::Base)'

module Spec
  module Rails
    module Example

      class RoutingExampleGroup < ActionController::TestCase
        tests Class.new(ActionController::Base)

        Spec::Example::ExampleGroupFactory.register(:routing, self)


On 19 July 2010 12:32, Shane Mingins <elc at mingins.com> wrote:

> Hi All
> I was wondering if someone could perhaps point me to where in RSpec::Rails
> is the Rails ActionController being subclassed by an Object instance?  My
> ruby-fu is not high enough to work out what's really going on with
> RSpec::Rails with this.
> The problem I am having (and I have a code example in the github link below
> if you want to see, just clone and run rake spec) is that Sunspot is adding
> an after filter to already loaded subclasses of ActionController::Base.
> loaded_controllers =
>             [base].concat(base.subclasses.map { |subclass|
> subclass.constantize })
> But that map is returning:
> ["ActionView::TestCase::TestController", "ApplicationController",
> "#<Class:0x1022e1168>",
> "Spec::Rails::Example::ViewExampleGroupController",
> "Spec::Rails::Example::HelperExampleGroupController"]
> So I am trying to find what #<Class:0x1022e1168> is and where it's
> subclassing ActionController.
> If I comment out config.gem "rspec-rails" in the environment.rb the problem
> goes away, but that is not a solution as I have boiled this issue down to
> what I have here from a project that is actually using bundler and so these
> gems are being specified and required.
> As I do not know what in RSpec::Rails is actually causing the issue I
> cannot raise this as an issue with Sunspot with an example of possibly what
> they should be excluding in their code, if that is the solution to move to.
> So if anyone could help me out in any way??  I'm happy to do more "leg
> work" if you could give me some pointers.
> Cheers
> Shane
> git repo showing issue:
> http://github.com/smingins/rspec-sunspot-conflict
> using ruby 1.8.7
> ruby -v
> ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100719/a49fa67b/attachment.html>

More information about the rspec-users mailing list