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,10 +36,22 @@ describe('Spec', function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('full name', function() {
|
||||||
|
describe('with string', function() {
|
||||||
it('getFullName returns suite & spec description', function () {
|
it('getFullName returns suite & spec description', function () {
|
||||||
var spec = new jasmine.Spec(env, suite, 'spec 1');
|
var spec = new jasmine.Spec(env, suite, 'spec 1');
|
||||||
expect(spec.getFullName()).toEqual('suite 1 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 () {
|
describe('results', function () {
|
||||||
var spec, results;
|
var spec, results;
|
||||||
|
|
|
@ -29,7 +29,8 @@ jasmine.Spec = function(env, suite, description) {
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.getFullName = function() {
|
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