Skip to content

Commit

Permalink
Specify the feature for creating a blog post
Browse files Browse the repository at this point in the history
We set up the entire acceptance test at once. This test will guide us through the rest of the unit testing and implementation of the feature.

Red: UnrecognizedURLError: /posts/new
  • Loading branch information
Josh Justice authored and CodingItWrong committed Jan 12, 2019
1 parent 85c7956 commit 1c39e97
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/acceptance/creating-a-blog-post-test.js
@@ -1,13 +1,21 @@
import { module, test } from 'qunit'; import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers'; import { visit, fillIn, click, currentRouteName } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit'; import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';


module('Acceptance | creating a blog post', function(hooks) { module('Acceptance | creating a blog post', function(hooks) {
setupApplicationTest(hooks); setupApplicationTest(hooks);
setupMirage(hooks);


test('visiting /creating-a-blog-post', async function(assert) { test('creating a blog post', async function(assert) {
await visit('/creating-a-blog-post'); await visit('/posts/new');


assert.equal(currentURL(), '/creating-a-blog-post'); await fillIn('.js-post-form-title', 'Test Post');
await fillIn('.js-post-form-body', 'This post is a test!');
await click('.js-post-form-save');

assert.equal(currentRouteName(), 'posts.show');
assert.dom('.js-post-detail-title').hasText('Test Post');
assert.dom('.js-post-detail-body').hasText('This post is a test!');
}); });
}); });

0 comments on commit 1c39e97

Please sign in to comment.