mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Merge pull request #2659 from AndrewKvalheim/transactional-tests
Use Rails transactional tests
This commit is contained in:
commit
0729c6f6fe
8 changed files with 4 additions and 39 deletions
|
|
@ -2,16 +2,7 @@
|
|||
|
||||
RSpec.configure do |config|
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.clean_with(:transaction)
|
||||
DatabaseCleaner.clean_with(:truncation)
|
||||
Rails.application.load_seed
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
||||
config.after(:each) do |example|
|
||||
TransactionalCapybara::AjaxHelpers.wait_for_ajax(page) if example.metadata[:js]
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActiveRecord
|
||||
class Base
|
||||
mattr_accessor :shared_connection
|
||||
@@shared_connection = nil
|
||||
|
||||
def self.connection
|
||||
@@shared_connection || retrieve_connection
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
|
||||
Loading…
Add table
Add a link
Reference in a new issue