Skip to content

Commit

Permalink
Make TestCase have a nicer toString() to that callback mocks aren't s…
Browse files Browse the repository at this point in the history
…o ugly.
  • Loading branch information
jcoglan committed Nov 5, 2013
1 parent 119f8fd commit c8fa052
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions source/test/unit/test_case.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ Test.Unit.extend({
shortName: shortName,
context: klassData.context.concat(klassData.shortName)
};
},

toString: function() {
return 'TestCase{' + this.metadata().fullName + '}';
}
})
});
Expand Down
4 changes: 2 additions & 2 deletions test/specs/test/mocking_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,14 +702,14 @@ Test.MockingSpec = JS.Test.describe(JS.Test.Mocking, function() { with(this) {
var testCase = this
runTests({
testCallback: function() { with(this) {
expect(this, "callback").on(receiver).given("hello")
expect(this, "callback").given("hello")
}}
}, function() { resume(function() {
assertTestResult( 1, 1, 1, 0)
assertMessage( 1, "Failure:\n" +
"testCallback(TestedSuite):\n" +
"Mock expectation not met\n" +
"<{}> expected to receive call\n" +
"<TestCase{TestedSuite testCallback}> expected to receive call\n" +
'callback( "hello" )' )
})})
}})
Expand Down

0 comments on commit c8fa052

Please sign in to comment.