0.5.4 • Published 9 years ago

fixative v0.5.4

Weekly downloads
10
License
MIT
Repository
github
Last release
9 years ago

Fixative

Fixative is a module for node that helps organize your mocha fixtures and test helpers.

Examples

Define a fixture task:

var fixture = require('fixative');
var expect = require('expect.js');

fixture.task({
  name: 'user',
  example: function () { return { name: 'alex' } }
});

fixture.create('user', function (error, o) {
  if (error) throw error;
  expect(o === fixture.user);
  expect(o.name === 'alex');
});

Fixture tasks are compatible with mocha.

describe('suite', function () {
  before(fixture.hook('user'));
  after(fixture.clean);

  it('does something', function () {
    expect(fixture.user).to.be.ok();
  });
});

You can also add helpers to your fixtures.

fixture.helper({
  name: 'lol',
  f: function () {
    return ('ha ha');
  }
});

expect(fixture.helper('lol')).to.be('ha ha');

Config

fixative uses the rc module for configuration. That means you can use a .fixativerc file or environment variables to configure fixative.

preload

Use this option to specify a directory or directories of fixture tasks to preload when fixative is required.

Put this in the project's .fixativerc:

{
  "preload": "./test/fixture,./node_modules/common-fixtures"
}

Alternatively, set an environment variable:

fixative_preload=./test/fixture npm test
0.5.4

9 years ago

0.5.3

10 years ago

0.1.1

10 years ago

0.2.3

10 years ago

0.3.2

10 years ago

0.4.2

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.6

10 years ago