mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 23:59:40 +02:00
Account:: namespace simplifications and cleanup (#2110)
* Flatten Holding model * Flatten balance model * Entries domain renames * Fix valuations reference * Fix trades stream * Fix brakeman warnings * Fix tests * Replace existing entryable type references in DB
This commit is contained in:
parent
f181ba941f
commit
e657c40d19
172 changed files with 1297 additions and 1258 deletions
|
@ -0,0 +1,35 @@
|
|||
require "test_helper"
|
||||
|
||||
class Transactions::BulkUpdatesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in @user = users(:family_admin)
|
||||
end
|
||||
|
||||
test "bulk update" do
|
||||
transactions = @user.family.entries.transactions
|
||||
|
||||
assert_difference [ "Entry.count", "Transaction.count" ], 0 do
|
||||
post transactions_bulk_update_url, params: {
|
||||
bulk_update: {
|
||||
entry_ids: transactions.map(&:id),
|
||||
date: 1.day.ago.to_date,
|
||||
category_id: Category.second.id,
|
||||
merchant_id: Merchant.second.id,
|
||||
tag_ids: [ Tag.first.id, Tag.second.id ],
|
||||
notes: "Updated note"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
assert_redirected_to transactions_url
|
||||
assert_equal "#{transactions.count} transactions updated", flash[:notice]
|
||||
|
||||
transactions.reload.each do |transaction|
|
||||
assert_equal 1.day.ago.to_date, transaction.date
|
||||
assert_equal Category.second, transaction.transaction.category
|
||||
assert_equal Merchant.second, transaction.transaction.merchant
|
||||
assert_equal "Updated note", transaction.notes
|
||||
assert_equal [ Tag.first.id, Tag.second.id ], transaction.entryable.tag_ids.sort
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue