Acceptance tests fail due to inFlight recording with ember 1.13.4 data

I just updated my ember data from 1.0-beta-18 to 1.13.4 and fixed all issues except this one that comes up during my acceptance tests when I try to execute an destroy

application in my afterEach

.

Error: Assertion Failed: You can only unload a record which is not inFlight. `<frontend@model:user::ember2881:null>`
    at new Error (native)
    at Error.EmberError (http://192.168.56.101:4200/assets/vendor.js:25627:21)
    at Object._emberMetalCore.default.assert (http://192.168.56.101:4200/assets/vendor.js:15879:13)
    at Object.ember$data$lib$system$model$states$$assertAgainstUnloadRecord [as unloadRecord] (http://192.168.56.101:4200/assets/vendor.js:80625:13)
    at InternalModel.ember$data$lib$system$model$internal$model$$InternalModel.send (http://192.168.56.101:4200/assets/vendor.js:82563:34)
    at InternalModel.ember$data$lib$system$model$internal$model$$InternalModel.unloadRecord (http://192.168.56.101:4200/assets/vendor.js:82441:14)
    at ember$data$lib$system$store$$Service.extend.unloadAll (http://192.168.56.101:4200/assets/vendor.js:84142:20)
    at Array.forEach (native)
    at ember$data$lib$system$store$$Service.extend.unloadAll (http://192.168.56.101:4200/assets/vendor.js:84133:48)
    at ember$data$lib$system$store$$Service.extend.willDestroy (http://192.168.56.101:4200/assets/vendor.js:85034:14)

      

When I deactivate the route in the application, I do a user.save()

, which makes xhr go outside and triggers this crash when the application is destroyed. Removal user.save()

. I've tried updating to the latest ember-cli-qunit

and ember-qunit

with no luck.

Mine afterEach

looks like this:

afterEach: function () {
    Ember.run(application, 'destroy');
    ajaxMock.shutdown();
}

      

This was not a problem before the update. How can I fix or work around this problem?

+3


source to share


1 answer


We have encountered something similar. In fact, we have defined a method destroy

on one of our objects (session service), unintentionally overriding Ember.Object destroy

. Renaming this to something else ( terminate

in our case) fixed the problem.



0


source







All Articles