2012-06-16 3 views
10

이전에 MySQL 데이터베이스를 사용하고 있었고 Postgresql로 전환하기로 결정했으며 rspec을 사용하여 테스트를 실행할 때 많은 경고와주의 사항이 나타납니다.Rspec : 테스트를 실행할 때 경고 및 알림을 표시하지 않으려면 어떻게해야합니까?

WARNING: there is already a transaction in progress 
NOTICE: there is no transaction in progress 
     should has link "Suspender" 
WARNING: there is already a transaction in progress 
NOTICE: there is no transaction in progress 
     should has css "title" with text "Suspensão de anúncio" 
WARNING: there is already a transaction in progress 
NOTICE: there is no transaction in progress 
     should has css "h1" with text "Awesome job!" 

어떻게 억제 할 수 있습니까? 방법이 있니?

+1

당신은 progress' 들인다 --format '플래그로 호출하고 있습니까? 어쩌면 .rspec 파일에서? –

+0

아니요. 내 .rspec 파일에'--colour','--drb' 및'--format d' 만 있습니다. –

+0

참조 : https://github.com/rspec/rspec-rails/issues/58 및 문제에서 제안 된대로 DB 클리너 사용을 고려하십시오. –

답변

18

다음과 같이 설정 했습니까? config.use_transactional_examples = true을 false로 설정하고 이것이 깨지는 지 확인하십시오.

+0

이 줄을 어디에 넣어야합니까? 나는 config/environments/test.rb와 config/application.rb에서 시도했다. 경고 메시지가 계속 나타납니다. – Prem

+0

안녕하세요. spec/spec_helper.rb 파일 – Prem

+0

에서 업데이트 됨. 마지막으로 너무 오랫동안 그 추악한 메시지를 살펴 보았습니다. 감사! –

4

나는 config.use_transactional_fixtures = true 세트입니다. 이는 기본값 (rails g rspec:install으로 생성 된 spec_helper)입니다. FactoryGirl 대신 조명기를 사용하여이 설정을 제거하면 경고가 제거됩니다.

RSpec에 : 당신이 데이터를 직접 관리하거나 당신을 위해 그것을 할 database_cleaner 같은 다른 도구를 사용하는 것을 선호하는 경우

+0

나를 위해 일했습니다! 감사! – John

관련 문제