mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Improve multisite testing (#14884)
This commit adds the RailsMultisite middleware in test mode when Rails.configuration.multisite is true. This allows for much more realistic integration testing. The `multisite_spec.rb` file is rewritten to avoid needing to simulate a middleware stack.
This commit is contained in:
@@ -291,6 +291,10 @@ RSpec.configure do |config|
|
||||
DB.test_transaction = ActiveRecord::Base.connection.current_transaction
|
||||
end
|
||||
|
||||
# Match the request hostname to the value in `database.yml`
|
||||
config.before(:all, type: [:request, :multisite]) { host! "test.localhost" }
|
||||
config.before(:each, type: [:request, :multisite]) { host! "test.localhost" }
|
||||
|
||||
config.before(:each, type: :multisite) do
|
||||
Rails.configuration.multisite = true # rubocop:disable Discourse/NoDirectMultisiteManipulation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user