Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Getting 'uninitialized constant' (NameError) when overriding an engine controller only using rspec #809

kassi opened this Issue Aug 18, 2013 · 3 comments


None yet
5 participants

kassi commented Aug 18, 2013

I have a weird (loading?) problem. I'm using rails 3.2.14 and rspec-rails 2.14.0.
I'm using an engine and have overridden an engine controller using the decorator pattern described in the docs.

When I run bundle exec rake, which runs the specs as default, I'm getting the error message 'uninitialized constant' in my decorator. It complains about the name that's defined in the engine (so not loaded yet).

When I run the printed command with /fully/specified/path/to/ruby -S rspec it works.

When I run ruby -S rspec it works, too.

When I run rspec it fails again, even though which rspec tells me it's in the same rvm gemset version as ruby is.

When I use testunit with the same code, I'm not getting any errors - even calling rake works fine. That's why I related this issue to rspec-rails.

The app btw works fine. It's using the decorator, overriding controller actions and extending the model of the engine from the main app.

I already created a question on stackoverflow and set up two demo projects: decorator_demo_rspec and decorator_demo_testunit.

Is this issue fixed yet? I am getting the same error. Is it an issue with Rspec?


samphippen commented Dec 14, 2015

@cupakromer is this still real? Can we close because stale?


JonRowe commented Dec 14, 2015

I vote close as stale until theres a reproduction in current rspec / rails versions.

@JonRowe JonRowe closed this Dec 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment