Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLEANUP] Remove unecessary wrap of rejection in run-loop #3821

Merged
merged 1 commit into from
Oct 7, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 4 additions & 38 deletions packages/ember-data/tests/unit/model/rollback-attributes-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,7 @@ test("invalid new record's attributes can be rollbacked", function() {
]);
var adapter = DS.RESTAdapter.extend({
ajax: function(url, type, hash) {
return new Ember.RSVP.Promise(function(resolve, reject) {
/* If InvalidError is passed back in the reject it will throw the
exception which will bubble up the call stack (crashing the test)
instead of hitting the failure route of the promise.
So wrapping the reject in an Ember.run.next makes it so save
completes without failure and the failure hits the failure route
of the promise instead of crashing the save. */
Ember.run.next(function() {
reject(error);
});
});
return Ember.RSVP.reject(error);
}
});

Expand Down Expand Up @@ -297,17 +287,7 @@ test("invalid record's attributes can be rollbacked", function() {

var adapter = DS.RESTAdapter.extend({
ajax: function(url, type, hash) {
return new Ember.RSVP.Promise(function(resolve, reject) {
/* If InvalidError is passed back in the reject it will throw the
exception which will bubble up the call stack (crashing the test)
instead of hitting the failure route of the promise.
So wrapping the reject in an Ember.run.next makes it so save
completes without failure and the failure hits the failure route
of the promise instead of crashing the save. */
Ember.run.next(function() {
reject(error);
});
});
return Ember.RSVP.reject(error);
}
});

Expand Down Expand Up @@ -368,17 +348,7 @@ test("invalid record's attributes rolled back to correct state after set", funct

var adapter = DS.RESTAdapter.extend({
ajax: function(url, type, hash) {
return new Ember.RSVP.Promise(function(resolve, reject) {
/* If InvalidError is passed back in the reject it will throw the
exception which will bubble up the call stack (crashing the test)
instead of hitting the failure route of the promise.
So wrapping the reject in an Ember.run.next makes it so save
completes without failure and the failure hits the failure route
of the promise instead of crashing the save. */
Ember.run.next(function() {
reject(error);
});
});
return Ember.RSVP.reject(error);
}
});

Expand Down Expand Up @@ -445,11 +415,7 @@ test("when destroying a record setup the record state to invalid, the record's a

var adapter = DS.RESTAdapter.extend({
ajax: function(url, type, hash) {
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.run.next(function() {
reject(error);
});
});
return Ember.RSVP.reject(error);
}
});

Expand Down