Skip to content
Permalink
Browse files

Add new post controller for save action

`ember g controller posts/new`

We implement a save handler by adding a new post controller to put it in, adding the handler, then passing it into the form component.

Outer red: expected posts.show, actual posts.new

Now the acceptance tests reports that the user isn't being transitioned to the posts.show route
  • Loading branch information...
CodingItWrong committed Jan 11, 2018
1 parent d1f12d7 commit db6f6d86a840ba469bb6756ab4909eb10052449e
Showing with 21 additions and 1 deletion.
  1. +8 −0 app/controllers/posts/new.js
  2. +1 −1 app/templates/posts/new.hbs
  3. +12 −0 tests/unit/controllers/posts/new-test.js
@@ -0,0 +1,8 @@
import Controller from '@ember/controller';

export default Controller.extend({
actions: {
savePost() {
}
}
});
@@ -1,3 +1,3 @@
<h1>New Post</h1>

<PostForm />
<PostForm @submitHandler={{action "savePost"}} />
@@ -0,0 +1,12 @@
import { moduleFor, test } from 'ember-qunit';

moduleFor('controller:posts/new', 'Unit | Controller | posts/new', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});

// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.subject();
assert.ok(controller);
});

0 comments on commit db6f6d8

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