Skip to content

Commit

Permalink
exclude no ssn if ssn present (#5031)
Browse files Browse the repository at this point in the history
* exclude no ssn if ssn present

* add check for no ssn
  • Loading branch information
jacobkagon authored Feb 19, 2025
1 parent 62cced4 commit 69e81b6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/domain/operations/people/create_or_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def create_new_person(person_entity)
def update_existing_person(person, person_entity)
person_params = person_entity.to_h
attributes_to_exclude = %i[addresses phones emails hbx_id]
attributes_to_exclude << :no_ssn if person.encrypted_ssn.present? && person.no_ssn.present?
if person.is_incarcerated && person_params[:is_incarcerated].nil?
attributes_to_exclude << :is_incarcerated
else
Expand Down
25 changes: 25 additions & 0 deletions spec/domain/operations/people/create_or_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,31 @@
end
end
end

context "Updating No SSN Attribute if SSN is present" do

before do
person.update_attributes!(ssn: '555555555', no_ssn: '0')
subject.call(params: person_params)
end

it "Does not update no_ssn attribute" do
person.reload
expect(person.no_ssn).to eql("0")
end
end

context "Updating No SSN Attribute if SSN is not present" do

before do
subject.call(params: person_params)
end

it "Updates no_ssn attribute" do
person.reload
expect(person.no_ssn).to eq "1"
end
end
end

context "update person with applicant's updates" do
Expand Down

0 comments on commit 69e81b6

Please sign in to comment.