我試圖預期rspec
測試中的錯誤。期望rspec測試中的錯誤
lambda {Participant.create!({:user_id => three.id, :match_id => match.id, :team => 1})}.should raise_error StandardError
現在我只是用StandardError
來確定它的工作。
1) StandardError in 'Participant should never allow more participants than players'.
This game is already full. Cannot add another player.
/home/josiah/Projects/Set-Match/app/models/participant.rb:12:in `do_not_exceed_player_count_in_match'
./spec/models/participant_spec.rb:24:
它顯然會引發錯誤,但我的測試仍然失敗。
想法?
感謝您的提示。 – 2010-03-02 05:45:33