mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Update test-prof (#7572)
* Updated test-prof * Made rails_helper.rb use new test-prof APIs Instead of the previous temporary hacks. * Added environment option to disable prefabrication It was removed mistakenly
This commit is contained in:
@@ -127,37 +127,30 @@ module TestSetup
|
||||
end
|
||||
end
|
||||
|
||||
module ActiveRecordAdapterWithSetup
|
||||
class << self
|
||||
ACTIVE_RECORD_ADAPTER = TestProf::BeforeAll::Adapters::ActiveRecord
|
||||
|
||||
def begin_transaction
|
||||
TestSetup.test_setup
|
||||
|
||||
ACTIVE_RECORD_ADAPTER.begin_transaction
|
||||
end
|
||||
|
||||
def rollback_transaction
|
||||
ACTIVE_RECORD_ADAPTER.rollback_transaction
|
||||
end
|
||||
TestProf::BeforeAll.configure do |config|
|
||||
config.before(:begin) do
|
||||
TestSetup.test_setup
|
||||
end
|
||||
end
|
||||
|
||||
TestProf::BeforeAll.adapter = ActiveRecordAdapterWithSetup
|
||||
|
||||
module Prefabrication
|
||||
def fab!(name, &blk)
|
||||
if ENV['PREFABRICATION'] == '0'
|
||||
if ENV['PREFABRICATION'] == '0'
|
||||
module Prefabrication
|
||||
def fab!(name, &blk)
|
||||
let!(name, &blk)
|
||||
else
|
||||
let_it_be(name, refind: true, &blk)
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.extend Prefabrication
|
||||
end
|
||||
else
|
||||
TestProf::LetItBe.configure do |config|
|
||||
config.alias_to :fab!, refind: true
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.fail_fast = ENV['RSPEC_FAIL_FAST'] == "1"
|
||||
config.extend Prefabrication
|
||||
config.include Helpers
|
||||
config.include MessageBus
|
||||
config.include RSpecHtmlMatchers
|
||||
|
||||
Reference in New Issue
Block a user