मैं 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:
यह स्पष्ट रूप से त्रुटि फेंकता है, लेकिन मेरा परीक्षण अभी भी विफल रहता है।
विचार?
धन्यवाद उपयोग करना संभव है। –