Betterspecs飼養rspec的約定,建議使用類似:與--format DOC
subject { assigns('message') }
it { should match /it was born in Billville/ }
是很好的做法。但如果我要運行DOC格式文件(rspec -f doc
)rspec的我收到:
When you call a matcher in an example without a String, like this:
specify { object.should matcher }
or this:
it { should matcher }
RSpec expects the matcher to have a #description method. You should either
add a String to the example this matcher is being used in, or give it a
description method. Then you won't have to suffer this lengthy warning again.
所以這
it "some desc" do
should match /it was born in Billville/
end
不會加那惱人的消息,但似乎醜陋。
關於如何保持rspec約定和代碼乾淨,並仍然有一些漂亮的輸出(如-f doc
)的任何想法?
rspec的v.2.13.0
嘗試:'subject(:message){assigns('message')}'在最新的rspec vsrsions中提供 – apneadiving 2013-03-01 16:51:38