jasmine-def
0.1.0 • Public • Published jasmine-def
Define lazily evaluated test data via def()
and subject()
functions.
Usage
Without jasmine-def
describe('old spec', function () {
beforeEach(function () {
this.options = { foo: 'foo' };
});
beforeEach(function () {
this.subject = new SomeObject(this.options)
});
it('works', function () {
expect(this.options).toBeDefined();
expect(this.subject).toBeDefined();
});
});
With jasmine-def
describe('new shiny spec', function () {
subject(function () {
return new SomeObject(this.options)
});
def('options', function () {
return { foo: 'foo' }
});
it('works', function () {
expect(this.options).toBeDefined();
expect(this.subject).toBeDefined();
});
});
Package Sidebar
Install
Weekly Downloads