是否有一些东西会影响到它的效果?#_ itesnt_behave_like'或者' group_will_fail_with(SomeError)'?我在文档中看不到任何内容,但我觉得这是理想的功能。 E.g。
shared_examples_for "a foo doer for admin" do
it "does this" do
...
end
it "does that" do
...
end
end
context "when logged in as an admin" do
let(:admin) { FactoryGirl :admin }
before(:each) { sign_in_as admin }
it_behaves_like "a foo doer for admin"
end
context "when logged in as a user" do
let(:user) { FactoryGirl :user }
before(:each) { sign_in_as user }
# is there something like this?
group_will_fail_with("a foo doer for admin", SomeError) / it_behaves_not_like "a foo maker" / etc.
end
如果这是反模式,或者我的想法有问题,那么所有的更正都会受到赞赏。