pat / combustion

Simple, elegant testing for Rails Engines
MIT License
707 stars 51 forks source link

uninitialized constant.. #115

Closed bagus1 closed 3 years ago

bagus1 commented 3 years ago

Hi ... am trying to upgrade an engine from Ruby 2.3.1 had combustion working those years ago the way I needed it to. The engine does some crazy stuff like loading routes from information in the database, so I need to run a task to load them during initialize. Long story short, this fails with 'uninitialized constant'.

Combustion.initialize! :all do MyEngine::MyModel.all end

Did something change? I've tried various ways of intializing the rails app in the internal directory on my own but get stuff like it complaining about the database.yml not being there or that I'm trying to initialize the Rails app more than once, etc. Let me know if you'd rather I just Stack this.

pat commented 3 years ago

Is MyEngine::MyModel the constant it can't find? Or is it something else? And I don't suppose the engine is open-source so I can see what else may be part of the issue?

I don't feel Combustion has changed dramatically in the past few years (and possibly longer), but when we're dealing with the complexity of Rails, there's many small things that could be part of the issue!

bagus1 commented 3 years ago

Thanks for the thoughts. I was able to work around this by initializing the constants I needed and loading the route information from the database in /spec/internal/config/routes.rb. You can close.