diff --git a/lib/email_repair/mechanic.rb b/lib/email_repair/mechanic.rb index f4aecd1..202c3de 100644 --- a/lib/email_repair/mechanic.rb +++ b/lib/email_repair/mechanic.rb @@ -26,8 +26,8 @@ def repair_all(emails) end OpenStruct.new( - sanitized_emails: sanitized_emails, - invalid_emails: invalid_emails, + sanitized_emails: sanitized_emails.uniq, + invalid_emails: invalid_emails.uniq, ) end diff --git a/spec/lib/email_repair/mechanic_spec.rb b/spec/lib/email_repair/mechanic_spec.rb index c067c19..b6ec817 100644 --- a/spec/lib/email_repair/mechanic_spec.rb +++ b/spec/lib/email_repair/mechanic_spec.rb @@ -5,9 +5,9 @@ module EmailRepair it 'sanitizes an array of emails and returns bulk results' do mechanic = Mechanic.new - salvageable_emails = %w(One@@two.com three@four.com) + salvageable_emails = %w(One@@two.com three@four.com one@twO.com) sanitized_emails = %w(one@two.com three@four.com) - bad_emails = %w(bleep@blop plooooooop) + bad_emails = %w(bleep@blop plooooooop plooOOooop) result = mechanic.repair_all(salvageable_emails + bad_emails) expect(result.sanitized_emails).to match_array sanitized_emails