Skip to content

Commit

Permalink
duplicate the frozen string to mutate, and return the string otherwise
Browse files Browse the repository at this point in the history
  • Loading branch information
tommasina-va committed Sep 20, 2024
1 parent 2689be5 commit 1493344
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 1493344

Please sign in to comment.