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

Fix duplicate category creation on import (#791)

* Repro

* Fix

* Update signage
This commit is contained in:
Zach Gollwitzer 2024-05-22 10:02:03 -04:00 committed by GitHub
parent 77f166a5f8
commit 41c991384a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 12 deletions

View file

@ -39,7 +39,10 @@ class ImportTest < ActiveSupport::TestCase
end
test "publishes a valid import" do
assert_difference -> { Transaction::Category.count } => 2, -> { Transaction.count } => 2 do
# Import has 3 unique categories: "Food & Drink", "Income", and "Shopping" (x2)
# Fixtures already define "Food & Drink" and "Income", so these should not be created
# "Shopping" is a new category, but should only be created 1x during import
assert_difference -> { Transaction.count } => 4, -> { Transaction::Category.count } => 1 do
@loaded_import.publish
end