Hi,
Working on unit tests and I have a few cascade delete constraints I am
testing.
The unit tests stop at the first assert_raise test. Is this typical?
def test_destroy_all_cascade_delete
assert_equal 1, Iep.find(:first).client_id
assert_equal 1, Encounter.find(:first).client_id
@client.destroy
assert_raise(ActiveRecord::RecordNotFound) { Iep.find(1) } <-- Stops
testing here
assert_raise(ActiveRecord::RecordNotFound) { Encounter.find(1) }
end
So if I comment out the client.destroy call, the first assert_raise fails
and the unit test doesn''t try the next one.
Thanks
Bob Silva
http://www.railtie.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060128/71663e6a/attachment-0001.html
On Jan 27, 2006, at 10:48 PM, Bob Silva wrote:> The unit tests stop at the first assert_raise test. Is this typical?Test::Unit stops at the first failed assertion. Rather than writing large tests testing every code path, create a test method per code path. It lets you find failures easier. (Multiple failures in one suite run rather than multiple suite runs fixing as you go, less time context switching between editing and running.) If you have code common to multiple tests refactor them into methods. If you have code common to multiple test cases refactor them into an abstract test class. -- Eric Hodel - drbrain@segment7.net - http://segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com