0

在我的 rspec 测试中,我的模型帖子有一堆属性:

it { should respond_to(:title) }
it { should respond_to(:description) }
it { should respond_to(:instruction) }
.
.
.

我可以更精确,在测试中使用更少的行,例如:

it { should respond_to(:title, :description, :instruction) }
4

1 回答 1

0

修复在https://github.com/evansagge/mongoid-rspec

it { should have_fields(:title, :description, :instruction) }

谢谢@Beerlington

于 2012-07-20T10:19:50.337 回答