In functional tests assign the object that the record becomes to the instance variable before saving

There is an issue where when the record become the external system object and is then saved, the record instance variable doesn't reflect the persistence.
It's easier to explain with code, so here goes

@record = Record.new(external_id: 'primo_id', external_system: 'primo')
=> Record instance
@record.becomes_external_system.save!
=> Saves without error
@record.new_record?
=> Returns true, WTF?

Obviously the above behavior is not what we want and sort of unexpected, so instead we do

@record = Record.new(external_id: 'primo_id', external_system: 'primo')
=> Record instance
(@record = @record.becomes_external_system).save!
=> Saves without error
@record.new_record?
=> Returns false

That's more like it.

I'm not sure if this unexpected behavior is a jRuby implementation issue or a general issue but I do know that inheritance + persistence is very strange.

The reason it worked before was that the external_system was getting written directly to the database and when it was found, it was no longer a new record, so it didn't try to create itself (via INSERT), it just wanted to update itself.