truemail-rspec 0.3.1 → 0.6.0
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 +59 -18
- data/.codeclimate.yml +1 -1
- data/.reek.yml +6 -0
- data/.rubocop.yml +54 -0
- data/CHANGELOG.md +121 -0
- data/Gemfile.lock +51 -51
- data/README.md +2 -1
- data/lib/truemail/rspec.rb +1 -0
- data/lib/truemail/rspec/auditor_helper.rb +1 -1
- data/lib/truemail/rspec/configuration_helper.rb +1 -1
- data/lib/truemail/rspec/validator_helper.rb +26 -13
- data/lib/truemail/rspec/version.rb +1 -1
- data/truemail-rspec.gemspec +11 -11
- metadata +34 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 114f3c307d854a6988182866e7feca4697284fd20b52a96a1e13b1e452fffe28
|
4
|
+
data.tar.gz: 983c0a0a3cddc80cb451486ff53d15e6948cfae9c434c0ad5d2df939f4b2f589
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59583cf1eac7f731f9d57e3a9bc698a4b964b301165347ea660b95f9a136b66a5c2a33e83f417f3e556d2eda3e4a8e876e5c2eec4bb0701b9eb169c918133357
|
7
|
+
data.tar.gz: 0deba058e67e28f9b034456a9a94f5e06999c4e7016ff095edb51d189f33afc3a7d0ad4516ee54eb796a4818cd4820abaacb5ae7764ea669a041f478870d1ccc
|
data/.circleci/config.yml
CHANGED
@@ -1,11 +1,21 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
1
3
|
defaults: &defaults
|
2
4
|
working_directory: ~/truemail-rspec
|
3
5
|
docker:
|
4
|
-
- image:
|
6
|
+
- image: cimg/ruby:<< parameters.ruby-version >>
|
5
7
|
environment:
|
6
8
|
CC_TEST_REPORTER_ID: 889fa37782e4f5d0f81705f0d869a9c907f04151faae8260dde55d3f74e65606
|
7
9
|
|
10
|
+
orbs:
|
11
|
+
ruby: circleci/ruby@1.1.3
|
12
|
+
|
8
13
|
references:
|
14
|
+
install_bundler: &install_bundler
|
15
|
+
run:
|
16
|
+
name: Installing Bundler
|
17
|
+
command: gem i bundler -v $(tail -1 Gemfile.lock | tr -d ' ')
|
18
|
+
|
9
19
|
restore_bundle_cache: &restore_bundle_cache
|
10
20
|
restore_cache:
|
11
21
|
keys:
|
@@ -24,66 +34,97 @@ references:
|
|
24
34
|
|
25
35
|
install_codeclimate_reporter: &install_codeclimate_reporter
|
26
36
|
run:
|
27
|
-
name:
|
37
|
+
name: Installing CodeClimate test reporter
|
28
38
|
command: |
|
29
39
|
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
30
40
|
chmod +x ./cc-test-reporter
|
31
41
|
|
32
|
-
version: 2
|
33
42
|
jobs:
|
34
|
-
linters:
|
43
|
+
linters-ruby:
|
44
|
+
parameters:
|
45
|
+
ruby-version:
|
46
|
+
type: string
|
47
|
+
|
35
48
|
<<: *defaults
|
36
49
|
|
37
50
|
steps:
|
38
51
|
- checkout
|
39
52
|
|
53
|
+
- <<: *install_bundler
|
40
54
|
- <<: *restore_bundle_cache
|
41
55
|
- <<: *bundle_install
|
42
56
|
- <<: *save_bundle_cache
|
43
57
|
|
44
58
|
- run:
|
45
|
-
name: Running
|
59
|
+
name: Running Overcommit
|
46
60
|
command: |
|
47
61
|
bundle exec overcommit -s
|
48
62
|
SKIP=AuthorEmail,AuthorName bundle exec overcommit -r
|
49
63
|
|
50
|
-
tests:
|
64
|
+
tests-ruby:
|
65
|
+
parameters:
|
66
|
+
ruby-version:
|
67
|
+
type: string
|
68
|
+
|
51
69
|
<<: *defaults
|
52
70
|
|
53
71
|
steps:
|
54
72
|
- checkout
|
55
73
|
|
74
|
+
- <<: *install_bundler
|
56
75
|
- <<: *restore_bundle_cache
|
57
76
|
- <<: *bundle_install
|
58
77
|
- <<: *save_bundle_cache
|
59
78
|
- <<: *install_codeclimate_reporter
|
60
79
|
|
61
80
|
- run:
|
62
|
-
name: Running
|
81
|
+
name: Running RSpec
|
63
82
|
command: |
|
64
|
-
mkdir /tmp/test-results
|
65
83
|
./cc-test-reporter before-build
|
66
84
|
bundle exec rspec
|
67
85
|
|
68
86
|
- run:
|
69
|
-
name:
|
87
|
+
name: Creating CodeClimate test coverage report
|
70
88
|
command: |
|
71
89
|
./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
|
72
90
|
|
73
|
-
- store_test_results:
|
74
|
-
path: /tmp/test-results
|
75
|
-
|
76
91
|
- store_artifacts:
|
77
|
-
|
78
|
-
|
92
|
+
name: Saving Simplecov coverage artifacts
|
93
|
+
path: ~/truemail-rspec/coverage
|
94
|
+
destination: coverage
|
79
95
|
|
80
96
|
- deploy:
|
97
|
+
name: Uploading CodeClimate test coverage report
|
81
98
|
command: |
|
82
99
|
./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
|
83
100
|
|
101
|
+
compatibility-ruby:
|
102
|
+
parameters:
|
103
|
+
ruby-version:
|
104
|
+
type: string
|
105
|
+
docker:
|
106
|
+
- image: cimg/ruby:<< parameters.ruby-version >>
|
107
|
+
steps:
|
108
|
+
- checkout
|
109
|
+
- ruby/install-deps:
|
110
|
+
with-cache: false
|
111
|
+
path: './vendor/custom_bundle'
|
112
|
+
- run:
|
113
|
+
name: Running compatibility tests
|
114
|
+
command: bundle exec rspec
|
115
|
+
|
84
116
|
workflows:
|
85
|
-
|
86
|
-
build:
|
117
|
+
build_and_test:
|
87
118
|
jobs:
|
88
|
-
- linters
|
89
|
-
|
119
|
+
- linters-ruby:
|
120
|
+
matrix:
|
121
|
+
parameters:
|
122
|
+
ruby-version: ["2.5"]
|
123
|
+
- tests-ruby:
|
124
|
+
matrix:
|
125
|
+
parameters:
|
126
|
+
ruby-version: ["2.5"]
|
127
|
+
- compatibility-ruby:
|
128
|
+
matrix:
|
129
|
+
parameters:
|
130
|
+
ruby-version: ["2.6", "2.7", "3.0"]
|
data/.codeclimate.yml
CHANGED
data/.reek.yml
CHANGED
@@ -11,6 +11,7 @@ detectors:
|
|
11
11
|
ControlParameter:
|
12
12
|
exclude:
|
13
13
|
- Truemail::RSpec::AuditorHelper#create_auditor
|
14
|
+
- Truemail::RSpec::ValidatorHelper#create_servers_list
|
14
15
|
|
15
16
|
NestedIterators:
|
16
17
|
exclude:
|
@@ -24,9 +25,14 @@ detectors:
|
|
24
25
|
DuplicateMethodCall:
|
25
26
|
exclude:
|
26
27
|
- Truemail::RSpec::ValidatorHelper#mx_layer
|
28
|
+
- Truemail::RSpec::ValidatorHelper#mx_blacklist_layer
|
27
29
|
- Truemail::RSpec::ValidatorHelper#smtp_layer
|
28
30
|
- Truemail::RSpec::ValidatorHelper#unstub_validation_layers
|
29
31
|
|
32
|
+
TooManyInstanceVariables:
|
33
|
+
exclude:
|
34
|
+
- Truemail::RSpec::ValidatorHelper::ValidatorFactory
|
35
|
+
|
30
36
|
LongParameterList:
|
31
37
|
enabled: false
|
32
38
|
|
data/.rubocop.yml
CHANGED
@@ -124,6 +124,21 @@ Style/RedundantArgument:
|
|
124
124
|
Style/SwapValues:
|
125
125
|
Enabled: true
|
126
126
|
|
127
|
+
Style/EndlessMethod:
|
128
|
+
Enabled: true
|
129
|
+
|
130
|
+
Style/HashConversion:
|
131
|
+
Enabled: true
|
132
|
+
|
133
|
+
Style/HashExcept:
|
134
|
+
Enabled: true
|
135
|
+
|
136
|
+
Style/IfWithBooleanLiteralBranches:
|
137
|
+
Enabled: true
|
138
|
+
|
139
|
+
Style/StringChars:
|
140
|
+
Enabled: true
|
141
|
+
|
127
142
|
Layout/EmptyLinesAroundAttributeAccessor:
|
128
143
|
Enabled: true
|
129
144
|
|
@@ -152,6 +167,9 @@ Layout/ClassStructure:
|
|
152
167
|
Layout/EmptyLineAfterGuardClause:
|
153
168
|
Enabled: false
|
154
169
|
|
170
|
+
Layout/SpaceBeforeBrackets:
|
171
|
+
Enabled: true
|
172
|
+
|
155
173
|
Lint/NonDeterministicRequireOrder:
|
156
174
|
Enabled: false
|
157
175
|
|
@@ -221,6 +239,33 @@ Lint/UnexpectedBlockArity:
|
|
221
239
|
Lint/UnmodifiedReduceAccumulator:
|
222
240
|
Enabled: true
|
223
241
|
|
242
|
+
Lint/AmbiguousAssignment:
|
243
|
+
Enabled: true
|
244
|
+
|
245
|
+
Lint/DeprecatedConstants:
|
246
|
+
Enabled: true
|
247
|
+
|
248
|
+
Lint/LambdaWithoutLiteralBlock:
|
249
|
+
Enabled: true
|
250
|
+
|
251
|
+
Lint/NumberedParameterAssignment:
|
252
|
+
Enabled: true
|
253
|
+
|
254
|
+
Lint/OrAssignmentToConstant:
|
255
|
+
Enabled: true
|
256
|
+
|
257
|
+
Lint/RedundantDirGlobSort:
|
258
|
+
Enabled: true
|
259
|
+
|
260
|
+
Lint/SymbolConversion:
|
261
|
+
Enabled: true
|
262
|
+
|
263
|
+
Lint/TripleQuotes:
|
264
|
+
Enabled: true
|
265
|
+
|
266
|
+
Gemspec/DateAssignment:
|
267
|
+
Enabled: true
|
268
|
+
|
224
269
|
Performance/AncestorsInclude:
|
225
270
|
Enabled: true
|
226
271
|
|
@@ -260,6 +305,15 @@ Performance/MethodObjectAsBlock:
|
|
260
305
|
Performance/Sum:
|
261
306
|
Enabled: true
|
262
307
|
|
308
|
+
Performance/MapCompact:
|
309
|
+
Enabled: true
|
310
|
+
|
311
|
+
Performance/RedundantEqualityComparisonBlock:
|
312
|
+
Enabled: true
|
313
|
+
|
314
|
+
Performance/RedundantSplitRegexpArgument:
|
315
|
+
Enabled: true
|
316
|
+
|
263
317
|
RSpec/ExampleLength:
|
264
318
|
Enabled: false
|
265
319
|
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,127 @@
|
|
1
1
|
# Changelog
|
2
|
+
|
2
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).
|
3
4
|
|
5
|
+
## [0.6.0] - 2021-05-13
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
# Truemail::Validator instance, successful case
|
11
|
+
create_validator(:mx_blacklist)
|
12
|
+
=> #<Truemail::Validator:0x00007fea91a1d528
|
13
|
+
@result=
|
14
|
+
#<struct Truemail::Validator::Result
|
15
|
+
success=true,
|
16
|
+
email="danyell@brakus-dooley.co",
|
17
|
+
domain="brakus-dooley.co",
|
18
|
+
mail_servers=["175.244.212.125", "69.106.253.221", "7.125.70.85", "152.249.195.7"],
|
19
|
+
errors={},
|
20
|
+
smtp_debug=nil,
|
21
|
+
configuration=
|
22
|
+
#<Truemail::Configuration:0x00007fea98977248
|
23
|
+
@blacklisted_domains=[],
|
24
|
+
@blacklisted_mx_ip_addresses=[],
|
25
|
+
@connection_attempts=2,
|
26
|
+
@connection_timeout=2,
|
27
|
+
@default_validation_type=:smtp,
|
28
|
+
@dns=[],
|
29
|
+
@email_pattern=/(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w|\-.+]*)@((?i-mx:[\p{L}0-9]+([\-.]{1}[\p{L}0-9]+)*\.\p{L}{2,63}))\z)/,
|
30
|
+
@not_rfc_mx_lookup_flow=false,
|
31
|
+
@response_timeout=2,
|
32
|
+
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
33
|
+
@smtp_fail_fast=false,
|
34
|
+
@smtp_safe_check=false,
|
35
|
+
@validation_type_by_domain={},
|
36
|
+
@verifier_domain="lubowitz.com",
|
37
|
+
@verifier_email="shante.keeling@lubowitz.com",
|
38
|
+
@whitelist_validation=false,
|
39
|
+
@whitelisted_domains=[]>>,
|
40
|
+
@validation_type=:mx_blacklist>
|
41
|
+
|
42
|
+
# Truemail::Validator instance, failure case
|
43
|
+
create_validator(:mx_blacklist, success: false)
|
44
|
+
=> #<Truemail::Validator:0x00007fea988cfd18
|
45
|
+
@result=
|
46
|
+
#<struct Truemail::Validator::Result
|
47
|
+
success=false,
|
48
|
+
email="mike.treutel@heathcote.biz",
|
49
|
+
domain="heathcote.biz",
|
50
|
+
mail_servers=["212.76.177.170", "253.244.87.72", "144.225.110.224"],
|
51
|
+
errors={:mx_blacklist=>"blacklisted mx server ip address"},
|
52
|
+
smtp_debug=nil,
|
53
|
+
configuration=
|
54
|
+
#<Truemail::Configuration:0x00007fea988ee150
|
55
|
+
@blacklisted_domains=[],
|
56
|
+
@blacklisted_mx_ip_addresses=["212.76.177.170", "253.244.87.72", "144.225.110.224"],
|
57
|
+
@connection_attempts=2,
|
58
|
+
@connection_timeout=2,
|
59
|
+
@default_validation_type=:smtp,
|
60
|
+
@dns=[],
|
61
|
+
@email_pattern=/(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w|\-.+]*)@((?i-mx:[\p{L}0-9]+([\-.]{1}[\p{L}0-9]+)*\.\p{L}{2,63}))\z)/,
|
62
|
+
@not_rfc_mx_lookup_flow=false,
|
63
|
+
@response_timeout=2,
|
64
|
+
@smtp_error_body_pattern=/(?=.*550)(?=.*(user|account|customer|mailbox)).*/i,
|
65
|
+
@smtp_fail_fast=false,
|
66
|
+
@smtp_safe_check=false,
|
67
|
+
@validation_type_by_domain={},
|
68
|
+
@verifier_domain="grant-flatley.org",
|
69
|
+
@verifier_email="mariano@grant-flatley.org",
|
70
|
+
@whitelist_validation=false,
|
71
|
+
@whitelisted_domains=[]>>,
|
72
|
+
@validation_type=:mx_blacklist>
|
73
|
+
```
|
74
|
+
|
75
|
+
- Ability to create `Truemail::Validator` instance for `MxBlacklist` validation layer
|
76
|
+
- Stub for `MxBlacklist` validation layer
|
77
|
+
- CircleCI config for using multiple Ruby versions
|
78
|
+
|
79
|
+
### Updated
|
80
|
+
|
81
|
+
- Updated gem development dependencies
|
82
|
+
|
83
|
+
### Fixed
|
84
|
+
|
85
|
+
- Simplecov coverage issues
|
86
|
+
|
87
|
+
## [0.5.0] - 2021-05-05
|
88
|
+
|
89
|
+
### Added
|
90
|
+
|
91
|
+
- Ability to set size for servers list
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
create_servers_list(42) # => returns array with 42 random ip addresses
|
95
|
+
```
|
96
|
+
|
97
|
+
### Updated
|
98
|
+
|
99
|
+
- gem runtime dependencies
|
100
|
+
- gem development dependencies
|
101
|
+
|
102
|
+
## [0.4.0] - 2021-02-24
|
103
|
+
|
104
|
+
### Updated
|
105
|
+
|
106
|
+
- gem runtime dependencies
|
107
|
+
- gem development dependencies
|
108
|
+
|
109
|
+
## [0.3.3] - 2020-12-06
|
110
|
+
|
111
|
+
### Added
|
112
|
+
|
113
|
+
- `faker` import
|
114
|
+
|
115
|
+
### Updated
|
116
|
+
|
117
|
+
- gem development dependencies
|
118
|
+
|
119
|
+
## [0.3.2] - 2020-12-06
|
120
|
+
|
121
|
+
### Fixed
|
122
|
+
|
123
|
+
- Namespace collisions for `faker`
|
124
|
+
|
4
125
|
## [0.3.1] - 2020-12-06
|
5
126
|
|
6
127
|
### Added
|
data/Gemfile.lock
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
truemail-rspec (0.
|
5
|
-
faker (~> 2.
|
4
|
+
truemail-rspec (0.6.0)
|
5
|
+
faker (~> 2.17)
|
6
6
|
rspec (~> 3.10)
|
7
|
-
truemail (
|
7
|
+
truemail (>= 2.4)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
ast (2.4.
|
13
|
-
bundler-audit (0.
|
12
|
+
ast (2.4.2)
|
13
|
+
bundler-audit (0.8.0)
|
14
14
|
bundler (>= 1.2.0, < 3)
|
15
|
-
thor (
|
15
|
+
thor (~> 1.0)
|
16
16
|
byebug (11.1.3)
|
17
17
|
childprocess (4.0.0)
|
18
18
|
coderay (1.1.3)
|
19
19
|
colorize (0.8.1)
|
20
|
-
concurrent-ruby (1.1.
|
20
|
+
concurrent-ruby (1.1.8)
|
21
21
|
diff-lcs (1.4.4)
|
22
|
-
docile (1.
|
23
|
-
faker (2.
|
22
|
+
docile (1.4.0)
|
23
|
+
faker (2.17.0)
|
24
24
|
i18n (>= 1.6, < 2)
|
25
|
-
fasterer (0.
|
25
|
+
fasterer (0.9.0)
|
26
26
|
colorize (~> 0.7)
|
27
27
|
ruby_parser (>= 3.14.1)
|
28
|
-
i18n (1.8.
|
28
|
+
i18n (1.8.10)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
30
|
iniparse (1.5.0)
|
31
|
-
json (2.
|
31
|
+
json (2.5.1)
|
32
32
|
kwalify (0.7.2)
|
33
33
|
method_source (1.0.0)
|
34
34
|
overcommit (0.57.0)
|
35
35
|
childprocess (>= 0.6.3, < 5)
|
36
36
|
iniparse (~> 1.4)
|
37
37
|
parallel (1.20.1)
|
38
|
-
parser (
|
38
|
+
parser (3.0.1.1)
|
39
39
|
ast (~> 2.4.1)
|
40
40
|
pry (0.13.1)
|
41
41
|
coderay (~> 1.1)
|
@@ -43,83 +43,83 @@ GEM
|
|
43
43
|
pry-byebug (3.9.0)
|
44
44
|
byebug (~> 11.0)
|
45
45
|
pry (~> 0.13.0)
|
46
|
-
psych (3.
|
46
|
+
psych (3.3.1)
|
47
47
|
rainbow (3.0.0)
|
48
|
-
rake (13.0.
|
49
|
-
reek (6.0.
|
48
|
+
rake (13.0.3)
|
49
|
+
reek (6.0.4)
|
50
50
|
kwalify (~> 0.7.0)
|
51
|
-
parser (
|
51
|
+
parser (~> 3.0.0)
|
52
52
|
psych (~> 3.1)
|
53
53
|
rainbow (>= 2.0, < 4.0)
|
54
|
-
regexp_parser (2.
|
55
|
-
rexml (3.2.
|
54
|
+
regexp_parser (2.1.1)
|
55
|
+
rexml (3.2.5)
|
56
56
|
rspec (3.10.0)
|
57
57
|
rspec-core (~> 3.10.0)
|
58
58
|
rspec-expectations (~> 3.10.0)
|
59
59
|
rspec-mocks (~> 3.10.0)
|
60
|
-
rspec-core (3.10.
|
60
|
+
rspec-core (3.10.1)
|
61
61
|
rspec-support (~> 3.10.0)
|
62
|
-
rspec-expectations (3.10.
|
62
|
+
rspec-expectations (3.10.1)
|
63
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
64
64
|
rspec-support (~> 3.10.0)
|
65
|
-
rspec-mocks (3.10.
|
65
|
+
rspec-mocks (3.10.2)
|
66
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
67
67
|
rspec-support (~> 3.10.0)
|
68
|
-
rspec-support (3.10.
|
69
|
-
rubocop (1.
|
68
|
+
rspec-support (3.10.2)
|
69
|
+
rubocop (1.14.0)
|
70
70
|
parallel (~> 1.10)
|
71
|
-
parser (>=
|
71
|
+
parser (>= 3.0.0.0)
|
72
72
|
rainbow (>= 2.2.2, < 4.0)
|
73
73
|
regexp_parser (>= 1.8, < 3.0)
|
74
74
|
rexml
|
75
|
-
rubocop-ast (>= 1.
|
75
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
76
76
|
ruby-progressbar (~> 1.7)
|
77
|
-
unicode-display_width (>= 1.4.0, <
|
78
|
-
rubocop-ast (1.
|
79
|
-
parser (>=
|
80
|
-
rubocop-performance (1.
|
81
|
-
rubocop (>=
|
77
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
78
|
+
rubocop-ast (1.5.0)
|
79
|
+
parser (>= 3.0.1.1)
|
80
|
+
rubocop-performance (1.11.3)
|
81
|
+
rubocop (>= 1.7.0, < 2.0)
|
82
82
|
rubocop-ast (>= 0.4.0)
|
83
|
-
rubocop-rspec (2.0
|
83
|
+
rubocop-rspec (2.3.0)
|
84
84
|
rubocop (~> 1.0)
|
85
85
|
rubocop-ast (>= 1.1.0)
|
86
|
-
ruby-progressbar (1.
|
87
|
-
ruby_parser (3.15.
|
86
|
+
ruby-progressbar (1.11.0)
|
87
|
+
ruby_parser (3.15.1)
|
88
88
|
sexp_processor (~> 4.9)
|
89
|
-
sexp_processor (4.15.
|
89
|
+
sexp_processor (4.15.2)
|
90
90
|
simplecov (0.17.1)
|
91
91
|
docile (~> 1.1)
|
92
92
|
json (>= 1.8, < 3)
|
93
93
|
simplecov-html (~> 0.10.0)
|
94
94
|
simplecov-html (0.10.2)
|
95
|
-
simpleidn (0.
|
95
|
+
simpleidn (0.2.1)
|
96
96
|
unf (~> 0.1.4)
|
97
|
-
thor (1.0
|
98
|
-
truemail (2.
|
99
|
-
simpleidn (~> 0.
|
97
|
+
thor (1.1.0)
|
98
|
+
truemail (2.4.1)
|
99
|
+
simpleidn (~> 0.2.1)
|
100
100
|
unf (0.1.4)
|
101
101
|
unf_ext
|
102
102
|
unf_ext (0.0.7.7)
|
103
|
-
unicode-display_width (
|
103
|
+
unicode-display_width (2.0.0)
|
104
104
|
|
105
105
|
PLATFORMS
|
106
|
-
|
106
|
+
x86_64-darwin-19
|
107
107
|
|
108
108
|
DEPENDENCIES
|
109
|
-
bundler (~>
|
110
|
-
bundler-audit (~> 0.
|
111
|
-
faker (~> 2.
|
112
|
-
fasterer (~> 0.
|
109
|
+
bundler (~> 2.2, >= 2.2.17)
|
110
|
+
bundler-audit (~> 0.8.0)
|
111
|
+
faker (~> 2.17)
|
112
|
+
fasterer (~> 0.9.0)
|
113
113
|
overcommit (~> 0.57.0)
|
114
114
|
pry-byebug (~> 3.9)
|
115
|
-
rake (~> 13.0, >= 13.0.
|
116
|
-
reek (~> 6.0, >= 6.0.
|
115
|
+
rake (~> 13.0, >= 13.0.3)
|
116
|
+
reek (~> 6.0, >= 6.0.4)
|
117
117
|
rspec (~> 3.10)
|
118
|
-
rubocop (~> 1.
|
119
|
-
rubocop-performance (~> 1.
|
120
|
-
rubocop-rspec (~> 2.
|
118
|
+
rubocop (~> 1.14)
|
119
|
+
rubocop-performance (~> 1.11, >= 1.11.3)
|
120
|
+
rubocop-rspec (~> 2.3)
|
121
121
|
simplecov (~> 0.17.1)
|
122
122
|
truemail-rspec!
|
123
123
|
|
124
124
|
BUNDLED WITH
|
125
|
-
|
125
|
+
2.2.17
|
data/README.md
CHANGED
@@ -122,13 +122,14 @@ Allows to create validator instance with default random or with predefined param
|
|
122
122
|
|
123
123
|
```ruby
|
124
124
|
create_servers_list # => returns array with random ip addresses
|
125
|
+
create_servers_list(42) # => returns array with 42 random ip addresses
|
125
126
|
```
|
126
127
|
|
127
128
|
#### create_validator
|
128
129
|
|
129
130
|
```ruby
|
130
131
|
create_validator(
|
131
|
-
validation_type, # optional, type:Symbol, can be :regex, :mx or :smtp, by default creates :smtp validation
|
132
|
+
validation_type, # optional, type:Symbol, can be :whitelist, :regex, :mx, :mx_blacklist or :smtp, by default creates :smtp validation
|
132
133
|
email, # optional, type:String, by default random email
|
133
134
|
mail_servers, # optional, type:Array(String), by default array with random ip addresses
|
134
135
|
success: true, # optional, type:Bool, by default true
|
data/lib/truemail/rspec.rb
CHANGED
@@ -5,7 +5,7 @@ module Truemail
|
|
5
5
|
module AuditorHelper
|
6
6
|
def create_auditor(
|
7
7
|
success: true,
|
8
|
-
current_host_ip: Faker::Internet.ip_v4_address,
|
8
|
+
current_host_ip: ::Faker::Internet.ip_v4_address,
|
9
9
|
warnings: { ip: Truemail::Audit::Ip::IPIFY_ERROR },
|
10
10
|
configuration: create_configuration
|
11
11
|
)
|
@@ -12,7 +12,7 @@ module Truemail
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def create_configuration(**configuration_settings)
|
15
|
-
configuration_settings[:verifier_email] = Faker::Internet.email unless configuration_settings[:verifier_email]
|
15
|
+
configuration_settings[:verifier_email] = ::Faker::Internet.email unless configuration_settings[:verifier_email]
|
16
16
|
Truemail::Configuration.new(&configuration_block(**configuration_settings))
|
17
17
|
end
|
18
18
|
end
|
@@ -3,13 +3,13 @@
|
|
3
3
|
module Truemail
|
4
4
|
module RSpec
|
5
5
|
module ValidatorHelper
|
6
|
-
def create_servers_list
|
7
|
-
Array.new(rand(1..4)) { Faker::Internet.ip_v4_address }
|
6
|
+
def create_servers_list(size = nil)
|
7
|
+
::Array.new(size || rand(1..4)) { ::Faker::Internet.ip_v4_address }
|
8
8
|
end
|
9
9
|
|
10
10
|
def create_validator( # rubocop:disable Metrics/ParameterLists
|
11
11
|
validation_type = nil,
|
12
|
-
email = Faker::Internet.email,
|
12
|
+
email = ::Faker::Internet.email,
|
13
13
|
mail_servers = create_servers_list,
|
14
14
|
rcptto_error: 'user not found',
|
15
15
|
success: true,
|
@@ -17,7 +17,7 @@ module Truemail
|
|
17
17
|
)
|
18
18
|
set_expected_result(validation_type, email, mail_servers, success, configuration, rcptto_error)
|
19
19
|
stub_validation_layers
|
20
|
-
validator_instance = ValidatorFactory.call(validation_type, success, email, configuration)
|
20
|
+
validator_instance = ValidatorFactory.call(validation_type, success, email, mail_servers, configuration)
|
21
21
|
unstub_validation_layers
|
22
22
|
validator_instance
|
23
23
|
end
|
@@ -39,6 +39,7 @@ module Truemail
|
|
39
39
|
case validation_type
|
40
40
|
when :regex then regex_layer
|
41
41
|
when :mx then mx_layer
|
42
|
+
when :mx_blacklist then mx_blacklist_layer
|
42
43
|
else smtp_layer
|
43
44
|
end
|
44
45
|
end
|
@@ -63,6 +64,13 @@ module Truemail
|
|
63
64
|
allow_any_instance_of(Truemail::Validate::Mx).to receive(:domain_not_include_null_mx).and_return(success)
|
64
65
|
end
|
65
66
|
|
67
|
+
def mx_blacklist_layer # rubocop:disable Metrics/AbcSize
|
68
|
+
allow(Truemail::Validate::Regex).to receive(:check).and_return(true)
|
69
|
+
allow_any_instance_of(Truemail::Validate::Mx).to receive(:mx_records).and_return(mail_servers)
|
70
|
+
allow_any_instance_of(Truemail::Validate::Mx).to receive(:domain_not_include_null_mx).and_return(true)
|
71
|
+
allow_any_instance_of(Truemail::Validate::MxBlacklist).to receive(:not_blacklisted_mail_servers?).and_return(success)
|
72
|
+
end
|
73
|
+
|
66
74
|
def request_instance
|
67
75
|
request = Truemail::Validate::Smtp::Request.new(
|
68
76
|
host: mail_servers.first,
|
@@ -92,14 +100,15 @@ module Truemail
|
|
92
100
|
end
|
93
101
|
|
94
102
|
class ValidatorFactory
|
95
|
-
def self.call(validation_type, success, email, configuration)
|
96
|
-
new(validation_type, success, email, configuration).build
|
103
|
+
def self.call(validation_type, success, email, mail_servers, configuration)
|
104
|
+
new(validation_type, success, email, mail_servers, configuration).build
|
97
105
|
end
|
98
106
|
|
99
|
-
def initialize(validation_type, success, email, configuration)
|
107
|
+
def initialize(validation_type, success, email, mail_servers, configuration)
|
100
108
|
@validation_type = validation_type
|
101
109
|
@success = success
|
102
110
|
@email = email
|
111
|
+
@mail_servers = mail_servers
|
103
112
|
@configuration = configuration
|
104
113
|
end
|
105
114
|
|
@@ -110,15 +119,19 @@ module Truemail
|
|
110
119
|
|
111
120
|
private
|
112
121
|
|
113
|
-
attr_reader :success, :email, :configuration
|
122
|
+
attr_reader :success, :email, :mail_servers, :configuration
|
114
123
|
attr_accessor :validation_type
|
115
124
|
|
116
125
|
def process_validator_params
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
126
|
+
case validation_type
|
127
|
+
when :whitelist
|
128
|
+
self.validation_type = nil
|
129
|
+
method = success ? :whitelisted_domains : :blacklisted_domains
|
130
|
+
domain = email[Truemail::RegexConstant::REGEX_EMAIL_PATTERN, 3]
|
131
|
+
configuration.tap { |config| config.public_send(method) << domain }
|
132
|
+
when :mx_blacklist
|
133
|
+
configuration.blacklisted_mx_ip_addresses.push(*mail_servers) unless success
|
134
|
+
end
|
122
135
|
end
|
123
136
|
end
|
124
137
|
end
|
data/truemail-rspec.gemspec
CHANGED
@@ -31,20 +31,20 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
32
|
spec.require_paths = ['lib']
|
33
33
|
|
34
|
-
spec.add_development_dependency 'bundler', '~>
|
35
|
-
spec.add_development_dependency 'bundler-audit', '~> 0.
|
36
|
-
spec.add_development_dependency 'faker', '~> 2.
|
37
|
-
spec.add_development_dependency 'fasterer', '~> 0.
|
34
|
+
spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.17'
|
35
|
+
spec.add_development_dependency 'bundler-audit', '~> 0.8.0'
|
36
|
+
spec.add_development_dependency 'faker', '~> 2.17'
|
37
|
+
spec.add_development_dependency 'fasterer', '~> 0.9.0'
|
38
38
|
spec.add_development_dependency 'overcommit', '~> 0.57.0'
|
39
39
|
spec.add_development_dependency 'pry-byebug', '~> 3.9'
|
40
|
-
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.
|
41
|
-
spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.
|
40
|
+
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.3'
|
41
|
+
spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.4'
|
42
42
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
43
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
44
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.
|
45
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 2.
|
43
|
+
spec.add_development_dependency 'rubocop', '~> 1.14'
|
44
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.11', '>= 1.11.3'
|
45
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.3'
|
46
46
|
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
47
|
-
spec.add_runtime_dependency 'faker', '~> 2.
|
47
|
+
spec.add_runtime_dependency 'faker', '~> 2.17'
|
48
48
|
spec.add_runtime_dependency 'rspec', '~> 3.10'
|
49
|
-
spec.add_runtime_dependency 'truemail', '
|
49
|
+
spec.add_runtime_dependency 'truemail', '>= 2.4'
|
50
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: truemail-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Trotsenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,62 +16,62 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.2.17
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
29
|
+
version: '2.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.2.17
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler-audit
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
39
|
+
version: 0.8.0
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
46
|
+
version: 0.8.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: faker
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 2.15.1
|
53
|
+
version: '2.17'
|
51
54
|
type: :development
|
52
55
|
prerelease: false
|
53
56
|
version_requirements: !ruby/object:Gem::Requirement
|
54
57
|
requirements:
|
55
58
|
- - "~>"
|
56
59
|
- !ruby/object:Gem::Version
|
57
|
-
version: '2.
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 2.15.1
|
60
|
+
version: '2.17'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: fasterer
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.
|
67
|
+
version: 0.9.0
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
74
|
+
version: 0.9.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: overcommit
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '13.0'
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 13.0.
|
112
|
+
version: 13.0.3
|
113
113
|
type: :development
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -119,7 +119,7 @@ dependencies:
|
|
119
119
|
version: '13.0'
|
120
120
|
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 13.0.
|
122
|
+
version: 13.0.3
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: reek
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,7 +129,7 @@ dependencies:
|
|
129
129
|
version: '6.0'
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: 6.0.
|
132
|
+
version: 6.0.4
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -139,7 +139,7 @@ dependencies:
|
|
139
139
|
version: '6.0'
|
140
140
|
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: 6.0.
|
142
|
+
version: 6.0.4
|
143
143
|
- !ruby/object:Gem::Dependency
|
144
144
|
name: rspec
|
145
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,60 +160,48 @@ dependencies:
|
|
160
160
|
requirements:
|
161
161
|
- - "~>"
|
162
162
|
- !ruby/object:Gem::Version
|
163
|
-
version: '1.
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: 1.5.2
|
163
|
+
version: '1.14'
|
167
164
|
type: :development
|
168
165
|
prerelease: false
|
169
166
|
version_requirements: !ruby/object:Gem::Requirement
|
170
167
|
requirements:
|
171
168
|
- - "~>"
|
172
169
|
- !ruby/object:Gem::Version
|
173
|
-
version: '1.
|
174
|
-
- - ">="
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
version: 1.5.2
|
170
|
+
version: '1.14'
|
177
171
|
- !ruby/object:Gem::Dependency
|
178
172
|
name: rubocop-performance
|
179
173
|
requirement: !ruby/object:Gem::Requirement
|
180
174
|
requirements:
|
181
175
|
- - "~>"
|
182
176
|
- !ruby/object:Gem::Version
|
183
|
-
version: '1.
|
177
|
+
version: '1.11'
|
184
178
|
- - ">="
|
185
179
|
- !ruby/object:Gem::Version
|
186
|
-
version: 1.
|
180
|
+
version: 1.11.3
|
187
181
|
type: :development
|
188
182
|
prerelease: false
|
189
183
|
version_requirements: !ruby/object:Gem::Requirement
|
190
184
|
requirements:
|
191
185
|
- - "~>"
|
192
186
|
- !ruby/object:Gem::Version
|
193
|
-
version: '1.
|
187
|
+
version: '1.11'
|
194
188
|
- - ">="
|
195
189
|
- !ruby/object:Gem::Version
|
196
|
-
version: 1.
|
190
|
+
version: 1.11.3
|
197
191
|
- !ruby/object:Gem::Dependency
|
198
192
|
name: rubocop-rspec
|
199
193
|
requirement: !ruby/object:Gem::Requirement
|
200
194
|
requirements:
|
201
195
|
- - "~>"
|
202
196
|
- !ruby/object:Gem::Version
|
203
|
-
version: '2.
|
204
|
-
- - ">="
|
205
|
-
- !ruby/object:Gem::Version
|
206
|
-
version: 2.0.1
|
197
|
+
version: '2.3'
|
207
198
|
type: :development
|
208
199
|
prerelease: false
|
209
200
|
version_requirements: !ruby/object:Gem::Requirement
|
210
201
|
requirements:
|
211
202
|
- - "~>"
|
212
203
|
- !ruby/object:Gem::Version
|
213
|
-
version: '2.
|
214
|
-
- - ">="
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
version: 2.0.1
|
204
|
+
version: '2.3'
|
217
205
|
- !ruby/object:Gem::Dependency
|
218
206
|
name: simplecov
|
219
207
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,20 +222,14 @@ dependencies:
|
|
234
222
|
requirements:
|
235
223
|
- - "~>"
|
236
224
|
- !ruby/object:Gem::Version
|
237
|
-
version: '2.
|
238
|
-
- - ">="
|
239
|
-
- !ruby/object:Gem::Version
|
240
|
-
version: 2.15.1
|
225
|
+
version: '2.17'
|
241
226
|
type: :runtime
|
242
227
|
prerelease: false
|
243
228
|
version_requirements: !ruby/object:Gem::Requirement
|
244
229
|
requirements:
|
245
230
|
- - "~>"
|
246
231
|
- !ruby/object:Gem::Version
|
247
|
-
version: '2.
|
248
|
-
- - ">="
|
249
|
-
- !ruby/object:Gem::Version
|
250
|
-
version: 2.15.1
|
232
|
+
version: '2.17'
|
251
233
|
- !ruby/object:Gem::Dependency
|
252
234
|
name: rspec
|
253
235
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,16 +248,16 @@ dependencies:
|
|
266
248
|
name: truemail
|
267
249
|
requirement: !ruby/object:Gem::Requirement
|
268
250
|
requirements:
|
269
|
-
- - "
|
251
|
+
- - ">="
|
270
252
|
- !ruby/object:Gem::Version
|
271
|
-
version: '2.
|
253
|
+
version: '2.4'
|
272
254
|
type: :runtime
|
273
255
|
prerelease: false
|
274
256
|
version_requirements: !ruby/object:Gem::Requirement
|
275
257
|
requirements:
|
276
|
-
- - "
|
258
|
+
- - ">="
|
277
259
|
- !ruby/object:Gem::Version
|
278
|
-
version: '2.
|
260
|
+
version: '2.4'
|
279
261
|
description: Truemail RSpec helpers
|
280
262
|
email:
|
281
263
|
- admin@bestweb.com.ua
|