Site para o estudio Velvet Design em São Paulo. http://velvetdesign.com.br

blog_posts_controller_test.rb 1.3KB

    require 'test_helper' class BlogPostsControllerTest < ActionController::TestCase setup do @blog_post = blog_posts(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:blog_posts) end test "should get new" do get :new assert_response :success end test "should create blog_post" do assert_difference('BlogPost.count') do post :create, blog_post: { author_id: @blog_post.author_id, content: @blog_post.content, published: @blog_post.published, slug: @blog_post.slug, title: @blog_post.title } end assert_redirected_to blog_post_path(assigns(:blog_post)) end test "should show blog_post" do get :show, id: @blog_post assert_response :success end test "should get edit" do get :edit, id: @blog_post assert_response :success end test "should update blog_post" do patch :update, id: @blog_post, blog_post: { author_id: @blog_post.author_id, content: @blog_post.content, published: @blog_post.published, slug: @blog_post.slug, title: @blog_post.title } assert_redirected_to blog_post_path(assigns(:blog_post)) end test "should destroy blog_post" do assert_difference('BlogPost.count', -1) do delete :destroy, id: @blog_post end assert_redirected_to blog_posts_path end end