Unload Rails app

I have a situation where I am developing a Railtie Engine and have two dummy apps for testing, and therefore two distinct ‘rails_helper.rb’ helpers to load one or the other app per specific spec file.


require File.expand_path(“dummy_1/config/environment”, File.dirname(FILE))



require File.expand_path(“dummy_2/config/environment”, File.dirname(FILE))


Then specs like:


require ‘rails_helper_1.rb’



require ‘rails_helper_2.rb’


The problem is that, once the environment from dummy_1 is loaded and RSpec tries to load the environment from dummy_1, it throws the error: ‘initialize!’: Application has been already initialized. (RuntimeError)

I cannot find the way to “unload” or “uninitialize” a currently loaded app env from RSpec, any ideas?