Betterspecsは、次のようなものを使用することを提案しています。
subject { assigns('message') }
it { should match /it was born in Billville/ }
良い習慣として。しかし、rspec を doc 形式 ( rspec -f doc
)で実行したい場合は、次のメッセージが表示されます。
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