Unload Rails app

23 views
Skip to first unread message

Bryan Liff

unread,
Oct 29, 2015, 1:30:23 PM10/29/15
to Ruby on Rails: Core
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.

# rails_helper_1.rb
...
require File.expand_path("dummy_1/config/environment", File.dirname(__FILE__))
...


# rails_helper_2.rb
...
require File.expand_path("dummy_2/config/environment", File.dirname(__FILE__))
...


Then specs like:

# spec/controllers/dummy_1/some_controller_spec.rb
require 'rails_helper_1.rb'
...


# spec/controllers/dummy_2/some_controller_spec.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?

T.J. Schuck

unread,
Oct 29, 2015, 1:56:07 PM10/29/15
to rubyonra...@googlegroups.com
This mailing list (rubyonrails-core) is intended for discussion about development of the framework itself, not usage of it.

For support issues or usage questions like this one that are not issues with Rails itself, please post to the rubyonrails-talk mailing list (http://groups.google.com/group/rubyonrails-talk) or somewhere like StackOverflow using the `ruby-on-rails` tag (http://stackoverflow.com/questions/tagged/ruby-on-rails).  You can also drop in to the #rubyonrails channel on irc.freenode.net for realtime help.  You'll be more likely to get a quick answer using one of those options.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages