testy/test/controllers/chains_controller_test.rb
Mohammad Kanaan 2cc3c1a7dd
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
initial commit
2026-05-17 14:12:43 +03:00

38 lines
837 B
Ruby

require "test_helper"
class ChainsControllerTest < ActionDispatch::IntegrationTest
setup do
@chain = chains(:one)
end
test "should get index" do
get chains_url, as: :json
assert_response :success
end
test "should create chain" do
assert_difference("Chain.count") do
post chains_url, params: { chain: { name: @chain.name } }, as: :json
end
assert_response :created
end
test "should show chain" do
get chain_url(@chain), as: :json
assert_response :success
end
test "should update chain" do
patch chain_url(@chain), params: { chain: { name: @chain.name } }, as: :json
assert_response :success
end
test "should destroy chain" do
assert_difference("Chain.count", -1) do
delete chain_url(@chain), as: :json
end
assert_response :no_content
end
end