if a spec description is given a function as the description, use its name as the displayed description
This commit is contained in:
parent
af7f1818b0
commit
222dda4e06
|
@ -36,9 +36,21 @@ describe('Spec', function () {
|
|||
});
|
||||
});
|
||||
|
||||
it('getFullName returns suite & spec description', function () {
|
||||
var spec = new jasmine.Spec(env, suite, 'spec 1');
|
||||
expect(spec.getFullName()).toEqual('suite 1 spec 1.');
|
||||
describe('full name', function() {
|
||||
describe('with string', function() {
|
||||
it('getFullName returns suite & spec description', function () {
|
||||
var spec = new jasmine.Spec(env, suite, 'spec 1');
|
||||
expect(spec.getFullName()).toEqual('suite 1 spec 1.');
|
||||
});
|
||||
});
|
||||
|
||||
describe('with class name', function () {
|
||||
function MyClass() {}
|
||||
it('getFullName returns suite & spec description', function () {
|
||||
var spec = new jasmine.Spec(env, suite, MyClass);
|
||||
expect(spec.getFullName()).toEqual('suite 1 MyClass.');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('results', function () {
|
||||
|
@ -121,4 +133,4 @@ describe('Spec', function () {
|
|||
expect(logResult.values).toEqual(["here's some log message", {key: 'value'}, 123]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,7 +29,8 @@ jasmine.Spec = function(env, suite, description) {
|
|||
};
|
||||
|
||||
jasmine.Spec.prototype.getFullName = function() {
|
||||
return this.suite.getFullName() + ' ' + this.description + '.';
|
||||
var description = (this.description.apply ? this.description.name : this.description);
|
||||
return this.suite.getFullName() + ' ' + description + '.';
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue