karma-jasmine-def
v0.1.0
Published
A Karma plugin. Lazy test subjects for Jasmine inspired by RSpec.
Downloads
967
Maintainers
Readme
karma-jasmine-def
Adds def
and subject
functions - a better way to setup Jasmine test subjects.
Usage
Install
npm install karma-jasmine karma-jasmine-def --save-dev
Configure Karma
module.exports = function(config) {
config.set({
frameworks: ['jasmine', 'jasmine-def']
});
};
Write specs
describe('a cleaner spec with lazy test subjects', 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();
});
});