Does Class.new(ActionController::Base) pass it to tests as a constant though? Reading comment # Expects +controller_class+ as a constant. Example: <tt>tests WidgetController</tt>. This is just me wondering if I am missing something with that Class.new(ActionController::Base) idiom.
Patch would just be a revert of http://github.com/dchelimsky/rspec-rails/commit/b488f3c9bd70011f1288f23b55490810b1fc693dthough right? I can do that and put it on lighthouse if you want ... and it goes up here https://rspec.lighthouseapp.com/projects/5645-rspec ?? And thanks for replying on Sunday :-) Cheers Shane On 19 July 2010 13:45, David Chelimsky <dchelim...@gmail.com> wrote: > > On Jul 18, 2010, at 8:29 PM, Shane Mingins wrote: > > And so ... > > # Sets the controller class name. Useful if the name can't be > inferred from test class. > # Expects +controller_class+ as a constant. Example: <tt>tests > WidgetController</tt>. > def tests(controller_class) > self.controller_class = controller_class > end > > But RoutingExampleGroup is: tests Class.new(ActionController::Base) > > Seems it's being called incorrectly from RoutingExampleGroup, is that > right? > > > Class.new(ActionController::Base) is standard Ruby for an anonymous > subclass. Nothing incorrect about it, but there's no significant value in > having it be anonymous, so I'd be OK changing it to a named subclass (i.e. > RoutingExampleGroupController < ActionController::Base). Wanna make a patch? > > > > On 19 July 2010 13:21, Shane Mingins <e...@mingins.com> wrote: > >> 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 >> >> 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 >>> >>> using ruby 1.8.7 >>> ruby -v >>> ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] >>> >> >> > _______________________________________________ > 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 >
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users