はじまりの大地

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
View File
+9
View File
@@ -0,0 +1,9 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
title: MyString
body: MyText
two:
title: MyString
body: MyText
View File
View File
View File
+7
View File
@@ -0,0 +1,7 @@
require "test_helper"
class PostTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
+15
View File
@@ -0,0 +1,15 @@
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"
module ActiveSupport
class TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
end