rspec + capybara를 사용하여 몇 가지 테스트를 만들었습니다. 내가 그들 모두가가드가 실행 중일 때 capybara 이상 동작을하는 Rspec
git:(master) ✗ rspec
Rack::File headers parameter replaces cache_control after Rack 1.5.
WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
.WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
.WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
.WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
.WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
.WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
.WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
.WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
.
Finished in 32.54 seconds
8 examples, 0 failures
통과 RSpec에 그들을 실행하지만 난 가드를 사용하는 경우 일부가 실패하는 경향이있다 (일부 테스트가 실패 할 수 있으며, 시간 수 없음에서 시간)
Guard output
이 동작을 어떻게 설명 할 수 있습니까? 어떻게 수정 될 수 있습니까?
업데이트 이미이 설정으로 gem 'database_cleaner'
을 사용하고 1
:
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:transaction)
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = :transaction
config.use_transactional_examples = true
업데이트 2
가에 따라 파일 https://github.com/Asmmund/notes/commit/a5e0a43d6247bb8f937fb7e9dcc8d8cfa7bfc4ea
을 : 아래쪽에서 위쪽으로 읽어, 귀하의 경우, 시간을 절약하기 위해? –
@MikhailNikalyukin 업데이트 1을 참조하십시오. – Elmor