Skip to content

Commit

Permalink
Merge pull request sproutcore#551 from castaclip/master
Browse files Browse the repository at this point in the history
corrected return values for SC.Record.isError() method
  • Loading branch information
etgryphon committed Aug 3, 2011
2 parents 39c62dd + 94e4ee5 commit 5620c68
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion frameworks/datastore/models/record.js
Expand Up @@ -729,7 +729,7 @@ SC.Record = SC.Object.extend(
@dependsOn status @dependsOn status
*/ */
isError: function() { isError: function() {
return this.get('status') & SC.Record.ERROR; return !!(this.get('status') & SC.Record.ERROR);
}.property('status').cacheable(), }.property('status').cacheable(),


/** /**
Expand Down
2 changes: 1 addition & 1 deletion frameworks/datastore/system/record_array.js
Expand Up @@ -635,7 +635,7 @@ SC.RecordArray = SC.Object.extend(SC.Enumerable, SC.Array,
@type Boolean @type Boolean
*/ */
isError: function() { isError: function() {
return this.get('status') & SC.Record.ERROR; return !!(this.get('status') & SC.Record.ERROR);
}.property('status').cacheable(), }.property('status').cacheable(),


/** /**
Expand Down
4 changes: 2 additions & 2 deletions frameworks/datastore/tests/models/record/error_methods.js
Expand Up @@ -45,8 +45,8 @@ test("Verify error methods behave correctly", function() {
store.dataSourceDidError(storeKey, SC.Record.GENERIC_ERROR); store.dataSourceDidError(storeKey, SC.Record.GENERIC_ERROR);
SC.RunLoop.end(); SC.RunLoop.end();


ok(thing1.get('isError'), "isError on thing1 should be YES"); ok((thing1.get('isError') === YES), "isError on thing1 should be YES");
ok(!thing2.get('isError'), "isError on thing2 should be NO"); ok((thing2.get('isError') === NO), "isError on thing2 should be NO");


equals(thing1.get('errorObject'), SC.Record.GENERIC_ERROR, equals(thing1.get('errorObject'), SC.Record.GENERIC_ERROR,
"get('errorObject') on thing1 should return the correct error object"); "get('errorObject') on thing1 should return the correct error object");
Expand Down
Expand Up @@ -43,7 +43,7 @@ test("Verify error methods behave correctly", function() {
store.dataSourceDidErrorQuery(q, SC.Record.GENERIC_ERROR); store.dataSourceDidErrorQuery(q, SC.Record.GENERIC_ERROR);
SC.RunLoop.end(); SC.RunLoop.end();


ok(things.get('isError'), "isError on things array should be YES"); ok((things.get('isError') === YES), "isError on things array should be YES");


equals(things.get('errorObject'), SC.Record.GENERIC_ERROR, equals(things.get('errorObject'), SC.Record.GENERIC_ERROR,
"get('errorObject') on things array should return the correct error object"); "get('errorObject') on things array should return the correct error object");
Expand Down

0 comments on commit 5620c68

Please sign in to comment.