我有一个简单的测试,根据我是否使用明确的主题,它似乎有不同的行为。
context "successful validation" do
subject(:invitation) {invitations(:emmet_invite)}
after do
invitation.send_voucher
end
it "calls hotel_booked?" do
invitation.should_receive(:hotel_booked?).and_return(true) #works
end
it {should_receive(:hotel_booked?).and_return(true)} #fails
end
这里有什么问题?