1295 |
1295 |
assert_equal [], User.find(2).bookmarked_project_ids
|
1296 |
1296 |
end
|
1297 |
1297 |
|
|
1298 |
def test_remove_custom_field_references_upon_destroy
|
|
1299 |
cf1 = IssueCustomField.create(field_format: 'user', name: 'user cf', is_for_all: true, tracker_ids: Tracker.pluck(:id))
|
|
1300 |
cf2 = IssueCustomField.create(field_format: 'user', name: 'users cf', is_for_all: true, multiple: true, tracker_ids: Tracker.pluck(:id))
|
|
1301 |
|
|
1302 |
issue = Issue.first
|
|
1303 |
issue.init_journal(@admin)
|
|
1304 |
assert_difference ->{cf1.custom_values.count} do
|
|
1305 |
assert_difference ->{cf2.custom_values.count}, 2 do
|
|
1306 |
issue.update_attributes(custom_field_values: {
|
|
1307 |
cf1.id => @jsmith.id,
|
|
1308 |
cf2.id => [@dlopper.id, @jsmith.id]
|
|
1309 |
})
|
|
1310 |
end
|
|
1311 |
end
|
|
1312 |
assert cv1 = cf1.custom_values.where(customized_id: issue.id).last
|
|
1313 |
assert_equal @jsmith.id.to_s, cv1.value
|
|
1314 |
|
|
1315 |
assert cv2 = cf2.custom_values.where(customized_id: issue.id)
|
|
1316 |
assert_equal 2, cv2.size
|
|
1317 |
assert cv2a = cv2.detect{|cv|cv.value == @dlopper.id.to_s}
|
|
1318 |
assert cv2b = cv2.detect{|cv|cv.value == @jsmith.id.to_s}
|
|
1319 |
|
|
1320 |
assert_difference ->{CustomValue.count}, -2 do
|
|
1321 |
@jsmith.destroy
|
|
1322 |
end
|
|
1323 |
|
|
1324 |
assert_raise(ActiveRecord::RecordNotFound){cv1.reload}
|
|
1325 |
assert_raise(ActiveRecord::RecordNotFound){cv2b.reload}
|
|
1326 |
|
|
1327 |
cv2a.reload
|
|
1328 |
assert_equal @dlopper.id.to_s, cv2a.value
|
|
1329 |
end
|
|
1330 |
|
1298 |
1331 |
if Object.const_defined?(:OpenID)
|
1299 |
1332 |
def test_setting_identity_url
|
1300 |
1333 |
normalized_open_id_url = 'http://example.com/'
|