WMeldon / ember-mocha-adapter

A mocha adapter for ember-testing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ember Mocha Adapter

A mocha adapter for ember-testing.

This adapter makes async testing ember apps with mocha easier.

It gets rid of the done() callback and lets you test without worrying whether your tests are sync or async.

Setup

Just include the adapter.js file in your test. The Mocha Adapter will automatically be set as the default Test Adapter.

Example:

describe("Adding a post", function() {

  beforeEach(function() {
    visit('posts/new');
  });

  afterEach(function() {
    App.reset();
  });

  it("should take me to a form", function() {
    find('form').should.exist;
  });

  it("should not submit with an empty title", function() {
    click('.submit').then(function() {
      find('.error').text().should.equal('Title is required.');
    });
  });

  it("should create a post on submit", function() {
    fillIn('.title', 'Test Post')
    .fillIn('.body', 'This is the body')
    .click('.submit')
    .then(function() {
      find('.post').should.exist;
      find('.post-title').text().should.equal('Test Post');
    });
  });


});

About

A mocha adapter for ember-testing.


Languages

Language:JavaScript 100.0%