I have my own gem, and my railtie looks like...
class MyRailtie < Rails::Railtie
initializer "my_railtie.configure_rails_initialization" do
# some initialization behavior
end
end
and I'm trying to test it, but in the tests the initializer never gets called. And I notice I have some dependences in another gems that have an initializer as well and they doesn't get called either.
Do you know what should I do besides require the file?
Since initializers are part of Rails' functionality, you'll need to load that Railtie into a Rails application in order for it to be invoked automatically. This is usually done by building a small Rails app inside your spec folder, but that's a pain to set up by hand. Luckily, there's an excellent gem called combustion which makes testing engines (or gems with railties) a breeze. It will take care of setting up that Rails app for you, and ensure your tests run in that Rails environment (including running that initializer).