mirror of
https://github.com/we-promise/sure.git
synced 2026-04-20 20:44:08 +00:00
Fix Account Holding validation and synchronization (#1818)
* Fix Account Holding validation and synchronization Fixes #1781 - Add comprehensive validations for Account::Holding - Implement validation to ensure amount matches qty * price - Update Account::Syncer to include qty and price during synchronization - Add database constraints for holding attributes and calculations * Remove database check constraints for Account Holdings Align with project convention of keeping complex validations in ActiveRecord - Remove database-level check constraints for quantity, price, and amount - Maintain database-level null and unique constraints - Prepare for more flexible validation in the model layer
This commit is contained in:
@@ -29,8 +29,8 @@ class Account::SyncerTest < ActiveSupport::TestCase
|
||||
|
||||
Account::HoldingCalculator.any_instance.expects(:calculate).returns(
|
||||
[
|
||||
Account::Holding.new(security: securities(:aapl), date: 1.day.ago.to_date, amount: 500, currency: "EUR"),
|
||||
Account::Holding.new(security: securities(:aapl), date: Date.current, amount: 500, currency: "EUR")
|
||||
Account::Holding.new(security: securities(:aapl), date: 1.day.ago.to_date, qty: 10, price: 50, amount: 500, currency: "EUR"),
|
||||
Account::Holding.new(security: securities(:aapl), date: Date.current, qty: 10, price: 50, amount: 500, currency: "EUR")
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user