Sha256: 243434235ae55bbfa257ac92de6da120a9b59abe0498ae3f45f078c76c7fb1aa
Contents?: true
Size: 1.34 KB
Versions: 10
Compression:
Stored size: 1.34 KB
Contents
require 'test_helper' module Admin class CommentsControllerTest < ActionController::TestCase setup do @comment = create(:comment) @product_id = @comment.commentable.id end test "should get index" do get :index, product_id: @product_id assert_response :success end test "should get show" do get :show, product_id: @product_id, id: @comment assert_response :success end test "should get new" do get :new, product_id: @product_id assert_response :success end test "should get edit" do get :edit, product_id: @product_id, id: @comment assert_response :success end test "should create" do assert_difference("Product.find('#{@product_id}').comments.count") do post :create, product_id: @product_id, comment: {author_name: 'Hello'} end assert_response 302 end test "should update" do patch :update, id: @comment.id, product_id: @product_id, comment: {author_name: 'World'} assert_redirected_to admin_product_comment_path(@comment.commentable, @comment) end test "should destroy" do assert_difference("Product.find('#{@product_id}').comments.count", -1) do delete :destroy, product_id: @product_id, id: @comment end assert_redirected_to admin_product_comments_path end end end
Version data entries
10 entries across 10 versions & 1 rubygems