mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-29 18:19:39 +02:00
Add rule option to change transaction name (#2175)
* Add change name rule for transaction * Use HTML template in the ERB, clone and inject those templates from the stimulus controller * Put back the ai_enabled check * Update docs * Example of what no case statement would look like * Remove action_type and needs_value now that controller is injecting templates/hiding action target * add "to" to template, improve no-option selection, ensure text box is cleared
This commit is contained in:
parent
c0267d5665
commit
60c3a04a48
6 changed files with 129 additions and 29 deletions
|
@ -79,4 +79,25 @@ class Rule::ActionTest < ActiveSupport::TestCase
|
|||
assert_equal merchant.id, transaction.reload.merchant_id
|
||||
end
|
||||
end
|
||||
|
||||
test "set_transaction_name" do
|
||||
new_name = "Renamed Transaction"
|
||||
|
||||
# Does not modify transactions that are locked (user edited them)
|
||||
@txn1.lock!(:name)
|
||||
|
||||
action = Rule::Action.new(
|
||||
rule: @transaction_rule,
|
||||
action_type: "set_transaction_name",
|
||||
value: new_name
|
||||
)
|
||||
|
||||
action.apply(@rule_scope)
|
||||
|
||||
assert_not_equal new_name, @txn1.reload.entry.name
|
||||
|
||||
[ @txn2, @txn3 ].each do |transaction|
|
||||
assert_equal new_name, transaction.reload.entry.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue