Refactor the from_xml methods to act on existing trace objects.

Setting the new tags with the = operator takes care of removing the
old ones, and is the same approach as taken by the tagstring= method.

Fixes #1600
This commit is contained in:
Andy Allan 2017-08-18 10:08:54 +01:00
parent e9324ad681
commit c647aa3d4d
3 changed files with 16 additions and 25 deletions

View file

@ -942,7 +942,10 @@ class TraceControllerTest < ActionController::TestCase
assert_response :success
updated = Trace.find(trace.id)
assert_equal trace.tags, updated.tags
# Ensure there's only one tag in the database after updating
assert_equal Tracetag.count, 1
# The new tag object might have a different id, so check the string representation
assert_equal trace.tagstring, updated.tagstring
end
# Check deleting a trace through the api