mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 23:59:40 +02:00
* Add sync model * Fresh fixtures for sync tests * Sync tests overhaul * Fix entry tests * Complete remaining model test updates * Update system tests * Update demo data task * Add system tests back to PR checks * More simplifications, add empty family to fixtures for easier testing
30 lines
841 B
Ruby
30 lines
841 B
Ruby
module Account::EntriesTestHelper
|
|
def create_transaction(attributes = {})
|
|
entry_attributes = attributes.except(:category, :tags, :merchant)
|
|
transaction_attributes = attributes.slice(:category, :tags, :merchant)
|
|
|
|
entry_defaults = {
|
|
account: accounts(:depository),
|
|
name: "Transaction",
|
|
date: Date.current,
|
|
currency: "USD",
|
|
amount: 100,
|
|
entryable: Account::Transaction.new(transaction_attributes)
|
|
}
|
|
|
|
Account::Entry.create! entry_defaults.merge(entry_attributes)
|
|
end
|
|
|
|
def create_valuation(attributes = {})
|
|
entry_defaults = {
|
|
account: accounts(:depository),
|
|
name: "Valuation",
|
|
date: 1.day.ago.to_date,
|
|
currency: "USD",
|
|
amount: 5000,
|
|
entryable: Account::Valuation.new
|
|
}
|
|
|
|
Account::Entry.create! entry_defaults.merge(attributes)
|
|
end
|
|
end
|