Skip to content

Commit

Permalink
Merge 55d81f1 into d399bb5
Browse files Browse the repository at this point in the history
  • Loading branch information
QuotableWater7 committed Jun 29, 2016
2 parents d399bb5 + 55d81f1 commit 5f2ef61
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/email_repair/mechanic.rb
Expand Up @@ -12,6 +12,8 @@ def repairs
end

def repair_all(emails)
emails = emails.reject(&:nil?).map(&:strip).reject { |email| email == '' }

sanitized_emails = []
invalid_emails = []

Expand Down
2 changes: 1 addition & 1 deletion lib/email_repair/version.rb
@@ -1,3 +1,3 @@
module EmailRepair
VERSION = '0.0.3'
VERSION = '0.1.0'
end
10 changes: 10 additions & 0 deletions spec/lib/email_repair/mechanic_spec.rb
Expand Up @@ -14,6 +14,16 @@ module EmailRepair
expect(result.invalid_emails).to match_array bad_emails
end

it 'filters out nil and empty string emails before processing results' do
mechanic = Mechanic.new
emails = [nil, '', ' ', 'bleep@bloop.com']

result = mechanic.repair_all(emails)

expect(result.sanitized_emails).to eq ['bleep@bloop.com']
expect(result.invalid_emails).to eq []
end

end

describe Mechanic, '#repair' do
Expand Down

0 comments on commit 5f2ef61

Please sign in to comment.