diff --git a/lib/floe/workflow/choice_rule/data.rb b/lib/floe/workflow/choice_rule/data.rb index 699a9eed..9ae8749d 100644 --- a/lib/floe/workflow/choice_rule/data.rb +++ b/lib/floe/workflow/choice_rule/data.rb @@ -11,8 +11,13 @@ class Data < Floe::Workflow::ChoiceRule def initialize(*) super @compare_key = payload.keys.detect { |key| key.match?(/^(#{COMPARE_KEYS.join("|")})/) } - raise Floe::InvalidWorkflowError, "Data-test Expression Choice Rule must have a compare key" if @compare_key.nil? + + if @compare_key&.end_with?("Path") + @ref_path = payload[compare_key] + else + @ref = payload[compare_key] + end end def true?(context, input) @@ -91,7 +96,7 @@ def is_timestamp?(value) # rubocop:disable Naming/PredicateName end def compare_value(context, input) - compare_key.end_with?("Path") ? Path.value(payload[compare_key], context, input) : payload[compare_key] + @ref_path ? Path.value(@ref_path, context, input) : @ref end end end