Displaying 1 result from an estimated 1 matches for "time_charge_id".
2006 Dec 28
0
problem with assert_raise in Unit Test
...and update a column with a duplicate foreign key.
Inside the unit test,
charge.time_logs << time_logs(:first)
will generate
ActiveRecord::StatementInvalid: Mysql::Error: #23000Duplicate entry
''20'' for key 2: UPDATE time_logs SET `task_id` = 1, `date_created` =
NULL, `time_charge_id` = 20, `hours` = 2.0, `log_entry` = NULL WHERE id
= 2
However,
assert_raise ActiveRecord::StatementInvalid do
charge.time_logs << time_logs(:first)
end
will generate
<ActiveRecord::StatementInvalid> exception expected but none was
thrown.
What am I doing wrong?
-...