Skip to content

Commit

Permalink
Assign blog post in controller
Browse files Browse the repository at this point in the history
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
Josh Justice committed Jan 10, 2018
1 parent dd8386c commit 41b396b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/blog_posts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class BlogPostsController < ApplicationController
def new
@blog_post = BlogPost.new
end
end

0 comments on commit 41b396b

Please sign in to comment.