mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
Sketch out business logic and basic tests
This commit is contained in:
parent
8effdcb2d3
commit
3bc0c18da0
11 changed files with 203 additions and 40 deletions
|
@ -40,7 +40,7 @@ class Demo::Generator
|
|||
create_tags!(family)
|
||||
create_categories!(family)
|
||||
create_merchants!(family)
|
||||
|
||||
create_rules!(family)
|
||||
puts "tags, categories, merchants created for #{family_name}"
|
||||
|
||||
create_credit_card_account!(family)
|
||||
|
@ -184,6 +184,19 @@ class Demo::Generator
|
|||
onboarded_at: Time.current
|
||||
end
|
||||
|
||||
def create_rules!(family)
|
||||
family.rules.create!(
|
||||
effective_date: 1.year.ago.to_date,
|
||||
active: true,
|
||||
conditions: [
|
||||
Rule::Condition.new(condition_type: "match_merchant", value: "Whole Foods")
|
||||
],
|
||||
actions: [
|
||||
Rule::Action.new(action_type: "set_category", value: "Groceries")
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
def create_tags!(family)
|
||||
[ "Trips", "Emergency Fund", "Demo Tag" ].each do |tag|
|
||||
family.tags.create!(name: tag)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue