1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00

Scaffold out basic transactions model and UI (#478)

* Transaction scaffold

* Rough in transaction views

* Fix sort order

* Fix mass assignment issue

* Fix test

* Simplify CI workflow

* Don't seed db before test
This commit is contained in:
Zach Gollwitzer 2024-02-23 21:34:33 -05:00 committed by GitHub
parent e767aca37f
commit 87b97b3c41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 430 additions and 44 deletions

View file

@ -0,0 +1,49 @@
require "test_helper"
class TransactionsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in @user = users(:bob)
@transaction = transactions(:one)
end
test "should get index" do
get transactions_url
assert_response :success
end
test "should get new" do
get new_transaction_url
assert_response :success
end
test "should create transaction" do
assert_difference("Transaction.count") do
post transactions_url, params: { transaction: { account_id: @transaction.account_id, amount: @transaction.amount, currency: @transaction.currency, date: @transaction.date, name: @transaction.name } }
end
assert_redirected_to transaction_url(Transaction.last)
end
test "should show transaction" do
get transaction_url(@transaction)
assert_response :success
end
test "should get edit" do
get edit_transaction_url(@transaction)
assert_response :success
end
test "should update transaction" do
patch transaction_url(@transaction), params: { transaction: { account_id: @transaction.account_id, amount: @transaction.amount, currency: @transaction.currency, date: @transaction.date, name: @transaction.name } }
assert_redirected_to transaction_url(@transaction)
end
test "should destroy transaction" do
assert_difference("Transaction.count", -1) do
delete transaction_url(@transaction)
end
assert_redirected_to transactions_url
end
end