testy/test/controllers/stores_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
1,003 B
Ruby

require "test_helper"
class StoresControllerTest < ActionDispatch::IntegrationTest
setup do
@store = stores(:one)
end
test "should get index" do
get stores_url, as: :json
assert_response :success
end
test "should create store" do
assert_difference("Store.count") do
post stores_url, params: { store: { chain_id: @store.chain_id, latitude: @store.latitude, longitude: @store.longitude, name: @store.name } }, as: :json
end
assert_response :created
end
test "should show store" do
get store_url(@store), as: :json
assert_response :success
end
test "should update store" do
patch store_url(@store), params: { store: { chain_id: @store.chain_id, latitude: @store.latitude, longitude: @store.longitude, name: @store.name } }, as: :json
assert_response :success
end
test "should destroy store" do
assert_difference("Store.count", -1) do
delete store_url(@store), as: :json
end
assert_response :no_content
end
end