Permalink
Browse files

Specify the feature for creating a blog post

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...
CodingItWrong committed Jan 10, 2018
1 parent e82954a commit 919d865a1dea73a6440c84110d83820789d748dd
Showing with 12 additions and 4 deletions.
  1. +12 −4 tests/acceptance/creating-a-blog-post-test.js
@@ -1,13 +1,21 @@
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 setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
module('Acceptance | creating a blog post', function(hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
test('visiting /creating-a-blog-post', async function(assert) {
await visit('/creating-a-blog-post');
test('creating a blog post', async function(assert) {
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 919d865

Please sign in to comment.