From 1493344d7f6315a775a64e297c334a3e805daf04 Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:27:00 -0500 Subject: [PATCH] duplicate the frozen string to mutate, and return the string otherwise --- .../form526_to_lighthouse_transform.rb | 4 ++-- .../form526_to_lighthouse_transform_spec.rb | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/evss/disability_compensation_form/form526_to_lighthouse_transform.rb b/lib/evss/disability_compensation_form/form526_to_lighthouse_transform.rb index ef314319cd6..bc4df80e136 100644 --- a/lib/evss/disability_compensation_form/form526_to_lighthouse_transform.rb +++ b/lib/evss/disability_compensation_form/form526_to_lighthouse_transform.rb @@ -582,8 +582,8 @@ def transform_disabilities(disabilities_source, toxic_exposure_conditions) end def format_exposure_text(cause, related_to_toxic_exposure) - text = TOXIC_EXPOSURE_CAUSE_MAP[cause.upcase.to_sym] - text.sub(/[.]?$/, '; toxic exposure.') if related_to_toxic_exposure + cause_text = TOXIC_EXPOSURE_CAUSE_MAP[cause.upcase.to_sym].dup + related_to_toxic_exposure ? cause_text.sub!(/[.]?$/, '; toxic exposure.') : cause_text end # rubocop:disable Naming/PredicateName diff --git a/spec/lib/evss/disability_compensation_form/form526_to_lighthouse_transform_spec.rb b/spec/lib/evss/disability_compensation_form/form526_to_lighthouse_transform_spec.rb index ca864f3036a..a5b88592b43 100644 --- a/spec/lib/evss/disability_compensation_form/form526_to_lighthouse_transform_spec.rb +++ b/spec/lib/evss/disability_compensation_form/form526_to_lighthouse_transform_spec.rb @@ -248,7 +248,8 @@ expect(results.first.exposure_or_event_or_injury).to eq(cause_map[:VA].sub(/[.]?$/, '; toxic exposure.')) expect(results[1].exposure_or_event_or_injury).to eq(cause_map[:NEW].sub(/[.]?$/, '; toxic exposure.')) expect(results[2].exposure_or_event_or_injury).to eq(cause_map[:WORSENED].sub(/[.]?$/, '; toxic exposure.')) - expect(results.last.exposure_or_event_or_injury).to eq(cause_map[:SECONDARY].sub(/[.]?$/, '; toxic exposure.')) + # last condition is not a toxic exposure condition + expect(results.last.exposure_or_event_or_injury).to eq(cause_map[:SECONDARY]) end end