mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Remove InvestmentActivityDetector and related functionality
- Deleted the `InvestmentActivityDetector` and associated tests. - Removed rake tasks for backfilling and clearing investment activity labels. - Simplified transaction processing in `SimplefinEntry::Processor` by removing inferred activity label logic. - Added new rule `SetInvestmentActivityLabel` for setting labels using rules. - Updated `Rule::Registry::TransactionResource` to include the new rule executor.
This commit is contained in:
@@ -100,4 +100,36 @@ class Rule::ActionTest < ActiveSupport::TestCase
|
||||
assert_equal new_name, transaction.reload.entry.name
|
||||
end
|
||||
end
|
||||
|
||||
test "set_investment_activity_label" do
|
||||
# Does not modify transactions that are locked (user edited them)
|
||||
@txn1.lock_attr!(:investment_activity_label)
|
||||
|
||||
action = Rule::Action.new(
|
||||
rule: @transaction_rule,
|
||||
action_type: "set_investment_activity_label",
|
||||
value: "Dividend"
|
||||
)
|
||||
|
||||
action.apply(@rule_scope)
|
||||
|
||||
assert_nil @txn1.reload.investment_activity_label
|
||||
|
||||
[ @txn2, @txn3 ].each do |transaction|
|
||||
assert_equal "Dividend", transaction.reload.investment_activity_label
|
||||
end
|
||||
end
|
||||
|
||||
test "set_investment_activity_label ignores invalid values" do
|
||||
action = Rule::Action.new(
|
||||
rule: @transaction_rule,
|
||||
action_type: "set_investment_activity_label",
|
||||
value: "InvalidLabel"
|
||||
)
|
||||
|
||||
result = action.apply(@rule_scope)
|
||||
|
||||
assert_equal 0, result
|
||||
assert_nil @txn1.reload.investment_activity_label
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user