mardi 17 janvier 2017

ember factory guy mockFindAll 2xs in the same spec

Using ember data factory guy, can we use mockFindAll 2xs in the same spec. We would visit a page with one of them passing, then click a button, revisit the same page and the second one would fail. Then we check for text on the screen. Does anyone have examples of this?

test('it displays a message when there are no results (501)', function(assert) {
  mockFindAll('my-quality-report').
    returns({ models: [report] });

  visit('/example');
  andThen(function() {
    mockFindAll('my-quality-report', {}).
      fails({ status: 501, errors: {} });

    click('#filter');
    andThen(function() {
      assert.equal(
        find('.results_callout h1').text().trim(), i18n.t('example.processing')
      );
    });
  });
});




Aucun commentaire:

Enregistrer un commentaire