On Jul 18, 2010, at 8:21 PM, Shane Mingins wrote:
> On 19 July 2010 12:32, Shane Mingins <e...@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
> 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)
> end
>
> end
> end
> end
Yeah - that looks like it.
Given that Class.new(BaseClass) is a common Ruby metaprogramming idiom, this
strikes me as a sunspot issue. WDYT?
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users