Development Tip

Rspec 출력 형식 : 문서

yourdevel 2020. 10. 29. 20:07
반응형

Rspec 출력 형식 : 문서


내가 실행할 때 rspecrake rspec나의 테스트가 확인되지 않습니다, 나는 오류 메시지가 표시됩니다. 하지만 테스트가 정상이면 그냥 '..'이 나옵니다. 다른 출력은 없습니다. 다음과 같이 인쇄하려면 어떻게해야합니까?

A User .... can only have one name
A User .... can ...

로부터 rspec도움말 페이지

$ rspec --help
Usage: rspec [options] [files or directories]

    -f, --format FORMATTER           Choose a formatter
                                       [p]rogress (default - dots)
                                       [d]ocumentation (group and example names)
                                       [h]tml
                                       [t]extmate
                                       custom formatter class name

패스 -f매개 변수를. 대신에

$ rake rspec

운영

$ rspec spec --format d

또는 짧은 형식 :

$ rspec -fd

구성을 영구적으로 유지 .rspec하려면 프로젝트의 루트에 파일을 만들고 거기에 구성을 작성하십시오.


당신의 내부 spec/spec_helper

RSpec.configure do |config|
  config.formatter = :documentation
end

따라서 매번 플래그를 실행할 필요가 없습니다.


사용하다:

rspec spec --format documentation

참고 URL : https://stackoverflow.com/questions/5083804/rspec-output-format-documentation

반응형