email_repair 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c006eab73457e196a6f2723466d75bd668c8c96f
4
- data.tar.gz: e51207841fc572de5a97f1247229a61e5f4b6d1f
3
+ metadata.gz: b4b69fd1e249e2e22790e3d2c4a1b504f2152bb9
4
+ data.tar.gz: b95be782fe298e8a3ec18cf89c6c89ac5a9f808a
5
5
  SHA512:
6
- metadata.gz: 44ba45751bf6e6a67fb9e69134603b380ea359bd5452321990665720e908abfc2dc60f4bc9d5894933a427fb63ac873379f7ccd6ffc53b0c7e295848cd15619b
7
- data.tar.gz: 2167ea3c6b132a7fddae6b02313c7c5f5c3e952488255f6ed5bb6a5cfd31cf48c63c6be8e2e24e67ffa6629921ceb0986034bacef46a2e9a3fff68e2e29c9f23
6
+ metadata.gz: 7ad8b2396bc3dc7d7be9ac80ff29491dbe20f2cfe965a3bfdfe5a2c80980c945fce5f08c53e3b3af1c9effde8fc792a9df50127bd119df24b6aadebfc1351ef0
7
+ data.tar.gz: 4600961f8e96f3e06e6712fddb8a917212ec485699a30286272b4738373135d06df29b5273256bd33c836da06a854696d5b4ddd4eada8baacd944ae7365c64a3
@@ -12,6 +12,8 @@ module EmailRepair
12
12
  end
13
13
 
14
14
  def repair_all(emails)
15
+ emails = emails.reject(&:nil?).map(&:strip).reject { |email| email == '' }
16
+
15
17
  sanitized_emails = []
16
18
  invalid_emails = []
17
19
 
@@ -26,8 +28,8 @@ module EmailRepair
26
28
  end
27
29
 
28
30
  OpenStruct.new(
29
- sanitized_emails: sanitized_emails,
30
- invalid_emails: invalid_emails,
31
+ sanitized_emails: sanitized_emails.uniq,
32
+ invalid_emails: invalid_emails.uniq,
31
33
  )
32
34
  end
33
35
 
@@ -1,3 +1,3 @@
1
1
  module EmailRepair
2
- VERSION = '0.0.3'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -5,15 +5,25 @@ module EmailRepair
5
5
 
6
6
  it 'sanitizes an array of emails and returns bulk results' do
7
7
  mechanic = Mechanic.new
8
- salvageable_emails = %w(One@@two.com three@four.com)
8
+ salvageable_emails = %w(One@@two.com three@four.com one@twO.com)
9
9
  sanitized_emails = %w(one@two.com three@four.com)
10
- bad_emails = %w(bleep@blop plooooooop)
10
+ bad_emails = %w(bleep@blop plooooooop plooOOooop)
11
11
 
12
12
  result = mechanic.repair_all(salvageable_emails + bad_emails)
13
13
  expect(result.sanitized_emails).to match_array sanitized_emails
14
14
  expect(result.invalid_emails).to match_array bad_emails
15
15
  end
16
16
 
17
+ it 'filters out nil and empty string emails before processing results' do
18
+ mechanic = Mechanic.new
19
+ emails = [nil, '', ' ', 'bleep@bloop.com']
20
+
21
+ result = mechanic.repair_all(emails)
22
+
23
+ expect(result.sanitized_emails).to eq ['bleep@bloop.com']
24
+ expect(result.invalid_emails).to eq []
25
+ end
26
+
17
27
  end
18
28
 
19
29
  describe Mechanic, '#repair' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_repair
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Holman Gao
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-28 00:00:00.000000000 Z
12
+ date: 2016-06-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: