@ Serabe의 솔루션을 구현했습니다. 요지보기 : https://gist.github.com/1142145.
파일 my_formatter.rb
을 spec 폴더에 넣고 rspec --formatter MyFormatter
을 실행하십시오. 포맷터는 현재 실행 결과를 이전 실행 결과와 비교하여 그 차이를 테이블로 출력합니다.
참고 : 포맷터는 현재 폴더에 result.txt
파일을 작성/덮어 씁니다.
사용 예제 :
D:\Projects\ZPersonal\equatable>rspec spec --format MyFormatter
..........
No changes since last run
Finished in 0.011 seconds
10 examples, 0 failures
No changes since last run
라인은 포맷터에 의해 추가되었다.
는 그리고 지금은 의도적으로 하나 다시 실행 RSpec에 깨진 :
D:\Projects\ZPersonal\equatable>rspec spec --format MyFormatter
..F.......
Affected tests (1).
PS CS Description
. F Equatable#== should be equal to the similar sock
PS - Previous Status
CS - Current Status
Failures:
1) Equatable#== should be equal to the similar sock
Failure/Error: subject.should == Sock.new(10, :black, 0)
expected: #<Sock:0x2fbb930 @size=10, @color=:black, @price=0>
got: #<Sock:0x2fbbae0 @size=10, @color=:black, @price=20> (using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Sock:0x2fbb930 @color=:black, @price=0, @size=10>
+#<Sock:0x2fbbae0 @color=:black, @price=20, @size=10>
# ./spec/equatable_spec.rb:30:in `block (3 levels) in <top (required)>'
Finished in 0.008 seconds
10 examples, 1 failure
Failed examples:
rspec ./spec/equatable_spec.rb:29 # Equatable#== should be equal to the similar sock
영향을받는 사양과 테이블은 포맷터에 의해 추가되었습니다
Affected tests (1).
PS CS Description
. F Equatable#== should be equal to the similar sock
PS - Previous Status
CS - Current Status
일부 사양 상태가 현재와 이전 실행과 다른 경우 포맷터는 이전 상태, 현재 상태 및 스펙 설명을 출력합니다. '.' 통과 된 사양을 나타내며 'F'는 실패했고 'P'는 대기 중입니다.
코드가 완벽하지 않으므로 자유롭게 비판하고 변경하십시오.
희망이 도움이됩니다. 궁금한 점이 있으면 알려주세요.
내가 지금하고있는 일이지만 파일이 너무 클 때 변경 사항을 보는 것은 쉽지 않습니다. –