From 1c39e9766aba89f9a27f9a339c4ba41e3bfc3627 Mon Sep 17 00:00:00 2001 From: Josh Justice Date: Wed, 10 Jan 2018 07:57:51 -0500 Subject: [PATCH] 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 --- tests/acceptance/creating-a-blog-post-test.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/creating-a-blog-post-test.js b/tests/acceptance/creating-a-blog-post-test.js index ed196c2..5283aa7 100644 --- a/tests/acceptance/creating-a-blog-post-test.js +++ b/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!'); }); });