2011-06-28 13:38:13 +00:00
|
|
|
# tiny patch to add middlewares after the initialization
|
|
|
|
module Rails
|
|
|
|
class Application < Engine
|
|
|
|
def app
|
|
|
|
@app ||= begin
|
|
|
|
if config.middleware.respond_to?(:merge_into)
|
|
|
|
config.middleware = config.middleware.merge_into(default_middleware_stack)
|
|
|
|
end
|
|
|
|
config.middleware.build(routes)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2011-04-05 00:18:17 +00:00
|
|
|
def Locomotive.configure_for_test(force = false)
|
2011-04-03 23:59:41 +00:00
|
|
|
Locomotive.configure do |config|
|
|
|
|
config.multi_sites do |multi_sites|
|
|
|
|
multi_sites.domain = 'example.com'
|
|
|
|
multi_sites.reserved_subdomains = %w(www admin email blog webmail mail support help site sites)
|
2010-05-30 23:57:33 +00:00
|
|
|
end
|
2011-04-05 00:18:17 +00:00
|
|
|
|
2011-04-03 23:59:41 +00:00
|
|
|
config.hosting = :none
|
2011-04-05 00:18:17 +00:00
|
|
|
|
2011-04-03 23:59:41 +00:00
|
|
|
config.enable_logs = true
|
2011-04-05 00:18:17 +00:00
|
|
|
|
|
|
|
if force
|
2011-08-13 23:24:02 +00:00
|
|
|
ENV['APP_TLD'] = ENV['HEROKU_SLUG'] = ENV['APP_NAME'] = ENV['HEROKU_LOGIN'] = ENV['HEROKU_PASSWORD'] = nil
|
|
|
|
|
2011-04-05 00:18:17 +00:00
|
|
|
Locomotive.define_subdomain_and_domains_options
|
|
|
|
|
|
|
|
Object.send(:remove_const, 'Site') if Object.const_defined?('Site')
|
|
|
|
load 'site.rb'
|
|
|
|
|
2011-07-26 21:11:43 +00:00
|
|
|
FactoryGirl.factories.clear
|
2011-04-05 00:18:17 +00:00
|
|
|
load File.join(Rails.root, 'spec', 'factories.rb')
|
|
|
|
end
|
2010-05-30 23:57:33 +00:00
|
|
|
end
|
2011-04-03 23:59:41 +00:00
|
|
|
end
|