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:
parent
92a6f71fd3
commit
f46d2ad086
|
@ -388,7 +388,7 @@ GEM
|
|||
sprockets (>= 3.0.0)
|
||||
sshkey (2.0.0)
|
||||
stackprof (0.2.12)
|
||||
test-prof (0.8.0)
|
||||
test-prof (0.9.0)
|
||||
thor (0.20.3)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.9)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue