We have a multidomain application, where each site can have multiple domains (for the locales)
ApplicationController is doing
def load_site
@site = Site.find_by!("domains like '%#{request.host}%'")
end
In my test suite i just want to make sure, that the website is showing up
spec/features/user_visits_homepage_spec.rb
require "rails_helper"
feature "User visits Homepage" do
site = FactoryGirl.create :site
scenario "successfully", js: true do
visit root_path
expect(page).to have_css "h1", text: site.name
end
end
my database_cleaner.rb
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
Question
how can i assure that i always have 1 Site since without a site no controller will work.
When i create the site as i did, the database_cleaner will always kill it.
Do i have a wrong understanding or do i miss something?