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:
parent
92a6f71fd3
commit
f46d2ad086
@ -388,7 +388,7 @@ GEM
|
|||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sshkey (2.0.0)
|
sshkey (2.0.0)
|
||||||
stackprof (0.2.12)
|
stackprof (0.2.12)
|
||||||
test-prof (0.8.0)
|
test-prof (0.9.0)
|
||||||
thor (0.20.3)
|
thor (0.20.3)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tilt (2.0.9)
|
tilt (2.0.9)
|
||||||
|
@ -127,37 +127,30 @@ module TestSetup
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module ActiveRecordAdapterWithSetup
|
TestProf::BeforeAll.configure do |config|
|
||||||
class << self
|
config.before(:begin) do
|
||||||
ACTIVE_RECORD_ADAPTER = TestProf::BeforeAll::Adapters::ActiveRecord
|
TestSetup.test_setup
|
||||||
|
|
||||||
def begin_transaction
|
|
||||||
TestSetup.test_setup
|
|
||||||
|
|
||||||
ACTIVE_RECORD_ADAPTER.begin_transaction
|
|
||||||
end
|
|
||||||
|
|
||||||
def rollback_transaction
|
|
||||||
ACTIVE_RECORD_ADAPTER.rollback_transaction
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
TestProf::BeforeAll.adapter = ActiveRecordAdapterWithSetup
|
if ENV['PREFABRICATION'] == '0'
|
||||||
|
module Prefabrication
|
||||||
module Prefabrication
|
def fab!(name, &blk)
|
||||||
def fab!(name, &blk)
|
|
||||||
if ENV['PREFABRICATION'] == '0'
|
|
||||||
let!(name, &blk)
|
let!(name, &blk)
|
||||||
else
|
|
||||||
let_it_be(name, refind: true, &blk)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.extend Prefabrication
|
||||||
|
end
|
||||||
|
else
|
||||||
|
TestProf::LetItBe.configure do |config|
|
||||||
|
config.alias_to :fab!, refind: true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.fail_fast = ENV['RSPEC_FAIL_FAST'] == "1"
|
config.fail_fast = ENV['RSPEC_FAIL_FAST'] == "1"
|
||||||
config.extend Prefabrication
|
|
||||||
config.include Helpers
|
config.include Helpers
|
||||||
config.include MessageBus
|
config.include MessageBus
|
||||||
config.include RSpecHtmlMatchers
|
config.include RSpecHtmlMatchers
|
||||||
|
Loading…
Reference in New Issue
Block a user