mail_autoconfig 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,7 +38,10 @@ module MailAutoconfig
|
|
38
38
|
# Finds the primary MX domain for this address. Would change gmail-smtp-in.l.google.com to google.com
|
39
39
|
# @return [String] the domain of the pimary MX record for this address
|
40
40
|
def primary_mx_domain
|
41
|
-
@primary_mx_domain ||=
|
41
|
+
@primary_mx_domain ||= begin
|
42
|
+
# Not very nice to 2nd level domains
|
43
|
+
mx_records.first.split(".")[-2..-1].join(".") unless mx_records.empty?
|
44
|
+
end
|
42
45
|
end
|
43
46
|
|
44
47
|
private
|
data/spec/email_address_spec.rb
CHANGED
@@ -39,4 +39,15 @@ describe MailAutoconfig::EmailAddress do
|
|
39
39
|
expect(address.client_config).to be_a(MailAutoconfig::ClientConfig)
|
40
40
|
end
|
41
41
|
end
|
42
|
+
|
43
|
+
context 'example@veryunlikelydomain4567763332.com' do
|
44
|
+
let(:address) { MailAutoconfig::EmailAddress.new('example@veryunlikelydomain4567763332.com') }
|
45
|
+
it 'should not return a configuration' do
|
46
|
+
expect(address.client_config).to be_false
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should not have a primary mx domain' do
|
50
|
+
expect(address.primary_mx_domain).to be_nil
|
51
|
+
end
|
52
|
+
end
|
42
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail_autoconfig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|