[rspec-users] controller filters running twice in 1.1.4?

Matt Mower self at mattmower.com
Wed Jun 4 04:25:55 EDT 2008

On Wed, Jun 4, 2008 at 4:29 AM, Pat Maddox <pergesu at gmail.com> wrote:
> On Tue, Jun 3, 2008 at 7:27 PM, Matt McNeil <nabble at mattmcneil.org> wrote:
>> Yes, application.rb appears to be getting loaded twice.  Things are fine
>> when the before_filter is being called from the UsersController:
>> class UsersController < ApplicationController
> Do you require application.rb from anywhere, but including the whole
> path?  i.e. require File.join(RAILS_ROOT, "app", "controllers",
> "application").  If you require the same file twice, but using two
> different paths, then it'll be loaded twice.
> This may happen from a plugin you've got loaded as well.

I've been seeing the same problem. In my case the symptom was a
warning about redefining a constant I have in ApplicationController.

I checked across my application and the only places I see application
being required (outside vendor/rails) are script/spec_server (and it's
template) and rspec-rails/lib/spec/rails.rb.

> Another thing to check is the paths in your generated specs.  I
> changed those a couple weeks ago, but to avoid this type of problem.
> I may have screwed up, or perhaps you've got a mix of requires from
> older gen'd specs and newer ones.

I'm not sure what "paths in your generated specs" means to check this myself.



Matt Mower :: http://matt.blogs.it/

More information about the rspec-users mailing list