2017-10-11 05:17:03 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe "Running Sidekiq Jobs in Multisite" do
|
2017-10-11 05:45:19 -04:00
|
|
|
let(:conn) { RailsMultisite::ConnectionManagement }
|
|
|
|
|
|
|
|
before do
|
|
|
|
conn.config_filename = "spec/fixtures/multisite/two_dbs.yml"
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
|
|
|
conn.clear_settings!
|
2018-08-30 05:30:32 -04:00
|
|
|
ActiveRecord::Base.establish_connection
|
2017-10-11 05:45:19 -04:00
|
|
|
end
|
|
|
|
|
2017-10-11 05:17:03 -04:00
|
|
|
it 'should revert back to the default connection' do
|
|
|
|
expect(RailsMultisite::ConnectionManagement.current_db)
|
|
|
|
.to eq('default')
|
|
|
|
|
|
|
|
Jobs::DestroyOldDeletionStubs.new.perform({})
|
|
|
|
|
|
|
|
expect(RailsMultisite::ConnectionManagement.current_db)
|
|
|
|
.to eq('default')
|
|
|
|
end
|
|
|
|
end
|