test/apps/rails4/test/controllers/posts_controller_test.rb in groonga-client-model-0.9.9 vs test/apps/rails4/test/controllers/posts_controller_test.rb in groonga-client-model-1.0.0

- old
+ new

@@ -1,50 +1,51 @@ require 'test_helper' -class PostsControllerTest < ActionDispatch::IntegrationTest +class PostsControllerTest < ActionController::TestCase include GroongaClientModel::TestHelper setup do @post = create(:post) end test "should get index" do - get posts_url + get :index assert_response :success + assert_not_nil assigns(:posts) end test "should get new" do - get new_post_url + get :new assert_response :success end test "should create post" do assert_difference('Post.count') do - post posts_url, params: { post: { body: @post.body, title: @post.title } } + post :create, post: { body: @post.body, title: @post.title } end - assert_redirected_to post_url(Post.last) + assert_redirected_to post_path(assigns(:post)) end test "should show post" do - get post_url(@post) + get :show, id: @post assert_response :success end test "should get edit" do - get edit_post_url(@post) + get :edit, id: @post assert_response :success end test "should update post" do - patch post_url(@post), params: { post: { body: @post.body, title: @post.title } } - assert_redirected_to post_url(@post) + patch :update, id: @post, post: { body: @post.body, title: @post.title } + assert_redirected_to post_path(assigns(:post)) end test "should destroy post" do assert_difference('Post.count', -1) do - delete post_url(@post) + delete :destroy, id: @post end - assert_redirected_to posts_url + assert_redirected_to posts_path end end