【发布时间】:2010-03-01 22:06:54
【问题描述】:
我试图预计 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:
它显然会抛出错误,但我的测试仍然失败。
想法?
【问题讨论】:
标签: ruby-on-rails rspec