當我運行rspec
與rake rspec
並且我的測試不正常時,出現錯誤消息。但是,當我的測試沒問題的時候,我只是得到'..'。沒有其他輸出。我怎樣才能得到它打印類似:Rspec輸出格式:文檔
A User .... can only have one name
A User .... can ...
當我運行rspec
與rake rspec
並且我的測試不正常時,出現錯誤消息。但是,當我的測試沒問題的時候,我只是得到'..'。沒有其他輸出。我怎樣才能得到它打印類似: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
文件和寫有配置。
用途:
rspec spec --format documentation
我會認爲它確實 - 有問題的命令完全是問題的問題。儘管如此,已經有一個(接受的)答案說明了同樣的事情,所以這個答案沒有增加任何實際價值。 – javawizard 2014-11-06 18:18:55
裏面你spec/spec_helper
RSpec.configure do |config|
config.formatter = :documentation
end
,所以你不必跑旗每次。
rspec -fd如果你想它短而甜。 rspec -c -fd如果你想在你的屏幕上看到顏色輸出:) – rmk 2011-02-22 20:56:10
你也可以使這個選項默認把它們放到你的'.rspec'文件中。我有'--color - iet --format文檔'(通過一行 - 每行選項)。 – 2014-02-20 16:45:50