truemail 3.0.0 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +2 -2
- data/.circleci/gemspec_compatible +3 -3
- data/.circleci/gemspec_latest +8 -8
- data/.codeclimate.yml +1 -1
- data/CHANGELOG.md +21 -0
- data/README.md +50 -0
- data/lib/truemail/core.rb +1 -1
- data/lib/truemail/version.rb +1 -1
- data/truemail.gemspec +4 -4
- metadata +8 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcfe95783a7652b910c7e7c6f8b9570a5bbeaa59409df51ccf05cc378e49d5e8
|
4
|
+
data.tar.gz: af43d9eb6b4c4db5c0d7874b6952b53a1f860e29e419db1f2d8d3b3711d61679
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee1113ef3b57d82d1f0b9dd2a153326c764922213b07ac6d249f59a36ebe298729bd53a98f221edc2fd1bacab5b34aa03a3ea7ea896304bdf43b578c244c1faa
|
7
|
+
data.tar.gz: 15f19155a57a25185a9eedbf6d9e12a62ee958395d06b86427779d5c913ed315eae9ac900920cd0305885059b9c82abc29d1e2d2de4f66e9b0b909dceedd7797
|
data/.circleci/config.yml
CHANGED
@@ -6,7 +6,7 @@ defaults: &defaults
|
|
6
6
|
- image: cimg/ruby:<< parameters.ruby-version >>
|
7
7
|
|
8
8
|
orbs:
|
9
|
-
ruby: circleci/ruby@
|
9
|
+
ruby: circleci/ruby@2.0.0
|
10
10
|
|
11
11
|
references:
|
12
12
|
restore_bundle_cache: &restore_bundle_cache
|
@@ -122,7 +122,7 @@ jobs:
|
|
122
122
|
- checkout
|
123
123
|
- <<: *use_compatible_gemspec
|
124
124
|
- ruby/install-deps:
|
125
|
-
bundler-version: "2.3.
|
125
|
+
bundler-version: "2.3.26"
|
126
126
|
with-cache: false
|
127
127
|
path: './vendor/custom_bundle'
|
128
128
|
- <<: *install_system_dependencies
|
@@ -35,8 +35,8 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency 'ffaker', '~> 2.21'
|
36
36
|
spec.add_development_dependency 'json_matchers', '~> 0.11.1'
|
37
37
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
|
38
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
39
|
-
spec.add_development_dependency 'smtp_mock', '~> 1.
|
40
|
-
spec.add_development_dependency 'truemail-rspec', '~> 0
|
38
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
39
|
+
spec.add_development_dependency 'smtp_mock', '~> 1.3'
|
40
|
+
spec.add_development_dependency 'truemail-rspec', '~> 1.0'
|
41
41
|
spec.add_development_dependency 'webmock', '~> 3.18', '>= 3.18.1'
|
42
42
|
end
|
data/.circleci/gemspec_latest
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| ::File.basename(f) }
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.add_runtime_dependency 'net-smtp', '~> 0.3.
|
32
|
+
spec.add_runtime_dependency 'net-smtp', '~> 0.3.3'
|
33
33
|
spec.add_runtime_dependency 'simpleidn', '~> 0.2.1'
|
34
34
|
|
35
35
|
spec.add_development_dependency 'bundler-audit', '~> 0.9.1'
|
@@ -40,13 +40,13 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_development_dependency 'overcommit', '~> 0.59.1'
|
41
41
|
spec.add_development_dependency 'pry-byebug', '~> 3.10', '>= 3.10.1'
|
42
42
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
|
43
|
-
spec.add_development_dependency 'reek', '~> 6.1', '>= 6.1.
|
44
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
45
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
46
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.15'
|
47
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 2.
|
43
|
+
spec.add_development_dependency 'reek', '~> 6.1', '>= 6.1.2'
|
44
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
45
|
+
spec.add_development_dependency 'rubocop', '~> 1.39'
|
46
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.15', '>= 1.15.1'
|
47
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.15'
|
48
48
|
spec.add_development_dependency 'simplecov', '~> 0.21.2'
|
49
|
-
spec.add_development_dependency 'smtp_mock', '~> 1.
|
50
|
-
spec.add_development_dependency 'truemail-rspec', '~> 0
|
49
|
+
spec.add_development_dependency 'smtp_mock', '~> 1.3'
|
50
|
+
spec.add_development_dependency 'truemail-rspec', '~> 1.0'
|
51
51
|
spec.add_development_dependency 'webmock', '~> 3.18', '>= 3.18.1'
|
52
52
|
end
|
data/.codeclimate.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,27 @@
|
|
2
2
|
|
3
3
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
4
4
|
|
5
|
+
## [3.0.2] - 2022.11.21
|
6
|
+
|
7
|
+
### Updated
|
8
|
+
|
9
|
+
- Updated gem runtime/development dependencies
|
10
|
+
- Updated gemspecs, circleci config
|
11
|
+
- Updated rubocop/codeclimate configs
|
12
|
+
- Updated gem version
|
13
|
+
|
14
|
+
## [3.0.1] - 2022.11.01
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
|
18
|
+
- Fixed wrong semantic version comparison in gemspec runtime dependency definition
|
19
|
+
|
20
|
+
### Updated
|
21
|
+
|
22
|
+
- Updated RSpec helpers
|
23
|
+
- Updated gemspecs, circleci config
|
24
|
+
- Updated gem version
|
25
|
+
|
5
26
|
## [3.0.0] - 2022.10.24
|
6
27
|
|
7
28
|
### Added
|
data/README.md
CHANGED
@@ -1451,6 +1451,56 @@ Truemail.configure do |config|
|
|
1451
1451
|
end
|
1452
1452
|
```
|
1453
1453
|
|
1454
|
+
Or you can use end-to-end approach and mock DNS and SMTP services with [`dns_mock`](https://github.com/mocktools/ruby-dns-mock), [`smtp_mock`](https://github.com/mocktools/ruby-smtp-mock) for your test environment like in example below:
|
1455
|
+
|
1456
|
+
```ruby
|
1457
|
+
# Gemfile
|
1458
|
+
|
1459
|
+
group :test do
|
1460
|
+
gem 'dns_mock', require: false
|
1461
|
+
gem 'smtp_mock', require: false
|
1462
|
+
end
|
1463
|
+
|
1464
|
+
# spec/spec_helper.rb
|
1465
|
+
|
1466
|
+
require 'dns_mock/test_framework/rspec'
|
1467
|
+
require 'smtp_mock/test_framework/rspec'
|
1468
|
+
|
1469
|
+
RSpec.configure do |config|
|
1470
|
+
config.include DnsMock::TestFramework::RSpec::Helper
|
1471
|
+
config.include SmtpMock::TestFramework::RSpec::Helper
|
1472
|
+
end
|
1473
|
+
|
1474
|
+
# spec/integration_spec.rb
|
1475
|
+
|
1476
|
+
RSpec.describe 'integration tests' do
|
1477
|
+
let(:target_email) { random_email }
|
1478
|
+
let(:dns_mock_records) { dns_mock_records_by_email(target_email, dimension: 2) }
|
1479
|
+
|
1480
|
+
before do
|
1481
|
+
dns_mock_server.assign_mocks(dns_mock_records)
|
1482
|
+
smtp_mock_server(**smtp_mock_server_options)
|
1483
|
+
|
1484
|
+
Truemail.configuration.tap do |config|
|
1485
|
+
config.dns = %W[127.0.0.1:#{dns_mock_server.port}]
|
1486
|
+
config.smtp_port = smtp_mock_server.port
|
1487
|
+
end
|
1488
|
+
end
|
1489
|
+
|
1490
|
+
context 'when checks real email' do
|
1491
|
+
let(:smtp_mock_server_options) { {} }
|
1492
|
+
|
1493
|
+
it { expect(Truemail.validate(target_email).result).to be_valid }
|
1494
|
+
end
|
1495
|
+
|
1496
|
+
context 'when checks fake email' do
|
1497
|
+
let(:smtp_mock_server_options) { { not_registered_emails: [target_email] } }
|
1498
|
+
|
1499
|
+
it { expect(Truemail.validate(target_email).result).not_to be_valid }
|
1500
|
+
end
|
1501
|
+
end
|
1502
|
+
```
|
1503
|
+
|
1454
1504
|
---
|
1455
1505
|
|
1456
1506
|
## Truemail family
|
data/lib/truemail/core.rb
CHANGED
@@ -19,7 +19,7 @@ module Truemail
|
|
19
19
|
end
|
20
20
|
|
21
21
|
module RegexConstant
|
22
|
-
REGEX_DOMAIN = /[\p{L}0-9]+([
|
22
|
+
REGEX_DOMAIN = /[\p{L}0-9]+([-.]{1}[\p{L}0-9]+)*\.\p{L}{2,63}/i.freeze
|
23
23
|
REGEX_SIMPLE_EMAIL_PATTERN = /\w+@\w+/.freeze
|
24
24
|
REGEX_EMAIL_PATTERN = %r{(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w\p{L}.+!~,'&%#*^`{}|\-/?=$]*)@(#{REGEX_DOMAIN})\z)}.freeze
|
25
25
|
REGEX_DOMAIN_PATTERN = /(?=\A.{4,255}\z)(\A#{REGEX_DOMAIN}\z)/.freeze
|
data/lib/truemail/version.rb
CHANGED
data/truemail.gemspec
CHANGED
@@ -29,15 +29,15 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| ::File.basename(f) }
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.add_runtime_dependency 'net-smtp', '~> 0.3.
|
32
|
+
spec.add_runtime_dependency 'net-smtp', '~> 0.3.3' if ::Gem::Version.new(::RUBY_VERSION) >= ::Gem::Version.new('3.1.0')
|
33
33
|
spec.add_runtime_dependency 'simpleidn', '~> 0.2.1'
|
34
34
|
|
35
35
|
spec.add_development_dependency 'dns_mock', '~> 1.5', '>= 1.5.5'
|
36
36
|
spec.add_development_dependency 'ffaker', '~> 2.21'
|
37
37
|
spec.add_development_dependency 'json_matchers', '~> 0.11.1'
|
38
38
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
|
39
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
40
|
-
spec.add_development_dependency 'smtp_mock', '~> 1.
|
41
|
-
spec.add_development_dependency 'truemail-rspec', '~> 0
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
40
|
+
spec.add_development_dependency 'smtp_mock', '~> 1.3'
|
41
|
+
spec.add_development_dependency 'truemail-rspec', '~> 1.0'
|
42
42
|
spec.add_development_dependency 'webmock', '~> 3.18', '>= 3.18.1'
|
43
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: truemail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Trotsenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simpleidn
|
@@ -98,48 +98,42 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: '3.
|
101
|
+
version: '3.12'
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '3.
|
108
|
+
version: '3.12'
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: smtp_mock
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: '1.
|
116
|
-
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: 1.2.2
|
115
|
+
version: '1.3'
|
119
116
|
type: :development
|
120
117
|
prerelease: false
|
121
118
|
version_requirements: !ruby/object:Gem::Requirement
|
122
119
|
requirements:
|
123
120
|
- - "~>"
|
124
121
|
- !ruby/object:Gem::Version
|
125
|
-
version: '1.
|
126
|
-
- - ">="
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
version: 1.2.2
|
122
|
+
version: '1.3'
|
129
123
|
- !ruby/object:Gem::Dependency
|
130
124
|
name: truemail-rspec
|
131
125
|
requirement: !ruby/object:Gem::Requirement
|
132
126
|
requirements:
|
133
127
|
- - "~>"
|
134
128
|
- !ruby/object:Gem::Version
|
135
|
-
version: 0
|
129
|
+
version: '1.0'
|
136
130
|
type: :development
|
137
131
|
prerelease: false
|
138
132
|
version_requirements: !ruby/object:Gem::Requirement
|
139
133
|
requirements:
|
140
134
|
- - "~>"
|
141
135
|
- !ruby/object:Gem::Version
|
142
|
-
version: 0
|
136
|
+
version: '1.0'
|
143
137
|
- !ruby/object:Gem::Dependency
|
144
138
|
name: webmock
|
145
139
|
requirement: !ruby/object:Gem::Requirement
|