Permalink
Browse files

Assign blog post in controller

We attempt to make the acceptance test pass by assigning the @blog_post instance variable in the controller. Note that we don't create a unit test for the controller. Many developers discourage controller tests because controller behavior is so closely related to acceptance test cases. Also, Rails 5 removes some controller test features that result in limiting how effective they can be.

Red: uninitialized constant BlogPostsController::BlogPost

The line of code we added isn't actually able to succeed because there is no class named BlogPost defined yet.
  • Loading branch information...
CodingItWrong committed Jun 14, 2016
1 parent 7144bb1 commit 6eb92b24f90c4663de45c685f23b32f14cb6a4ea
Showing with 1 addition and 0 deletions.
  1. +1 −0 app/controllers/blog_posts_controller.rb
@@ -1,4 +1,5 @@
class BlogPostsController < ApplicationController
def new
@blog_post = BlogPost.new
end
end

0 comments on commit 6eb92b2

Please sign in to comment.