3 class PostsControllerTest < ActionController::TestCase
8 test "should get index" do
10 assert_response :success
11 assert_not_nil assigns(:posts)
14 test "should get new" do
16 assert_response :success
19 test "should create post" do
20 assert_difference('Post.count') do
21 post :create, post: { content: @post.content, name: @post.name, title: @post.title }
24 assert_redirected_to post_path(assigns(:post))
27 test "should show post" do
29 assert_response :success
32 test "should get edit" do
34 assert_response :success
37 test "should update post" do
38 put :update, id: @post, post: { content: @post.content, name: @post.name, title: @post.title }
39 assert_redirected_to post_path(assigns(:post))
42 test "should destroy post" do
43 assert_difference('Post.count', -1) do
44 delete :destroy, id: @post
47 assert_redirected_to posts_path