はじまりの大地

This commit is contained in:
2025-02-25 22:43:13 +09:00
commit 5d64041c70
108 changed files with 20147 additions and 0 deletions
View File
@@ -0,0 +1,38 @@
require "test_helper"
class PostsControllerTest < ActionDispatch::IntegrationTest
setup do
@post = posts(:one)
end
test "should get index" do
get posts_url, as: :json
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 } }, as: :json
end
assert_response :created
end
test "should show post" do
get post_url(@post), as: :json
assert_response :success
end
test "should update post" do
patch post_url(@post), params: { post: { body: @post.body, title: @post.title } }, as: :json
assert_response :success
end
test "should destroy post" do
assert_difference("Post.count", -1) do
delete post_url(@post), as: :json
end
assert_response :no_content
end
end