Skip to content
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 37fd1fd commit fa1cdf79e98ec38340ba4f36c3f460215ff4c9fb
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) {

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(), '');
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 fa1cdf7

Please sign in to comment.
You can’t perform that action at this time.