truemail-rspec 0.1.3 → 0.3.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.
@@ -1,6 +1,59 @@
1
1
  # Changelog
2
2
  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
3
 
4
+ ## [0.3.2] - 2020-12-06
5
+
6
+ ### Fixed
7
+
8
+ - Namespace collisions for `faker`
9
+
10
+ ## [0.3.1] - 2020-12-06
11
+
12
+ ### Added
13
+
14
+ - Required `faker` runtime dependency
15
+
16
+ ## [0.3.0] - 2020-12-06
17
+
18
+ ### Added
19
+
20
+ Ability to pass custom context into rcptto error:
21
+
22
+ ```ruby
23
+ create_validator(
24
+ validation_type, # optional, type:Symbol, can be :regex, :mx or :smtp, by default creates :smtp validation
25
+ email, # optional, type:String, by default random email
26
+ mail_servers, # optional, type:Array(String), by default array with random ip addresses
27
+ success: true, # optional, type:Bool, by default true
28
+ rcptto_error: 'custom context of rcptto error' # optional, type:String, by default it's equal to 'user not found'
29
+ configuration: create_configuration # optional, type:Truemail::Configuration, by default creates random configuration
30
+ )
31
+ ```
32
+
33
+ ### Changed
34
+
35
+ - Updated `Truemail::RSpec::ValidatorHelper`
36
+ - gem development, runtime dependencies
37
+ - gem documentation
38
+
39
+ ## [0.2.1] - 2020-09-21
40
+
41
+ ### Changed
42
+
43
+ Migrated to updated Ruby 2.7.x syntax.
44
+
45
+ - Updated `Truemail::RSpec::ConfigurationHelper`
46
+
47
+ ## [0.2.0] - 2020-08-31
48
+
49
+ ### Added
50
+
51
+ - auditor RSpec helper
52
+
53
+ ### Removed
54
+
55
+ - gem public documentation
56
+
4
57
  ## [0.1.3] - 2020-08-24
5
58
 
6
59
  ### Added
@@ -6,28 +6,28 @@ Following these guidelines helps to communicate that you respect the time of the
6
6
 
7
7
  ## Using the issue tracker
8
8
 
9
- The issue tracker is the preferred channel for [bug reports](#bugs), [features requests](#features) and [submitting pull requests](#pull-requests).
9
+ The issue tracker is the preferred channel for [issue/bug reports](#issuebug-reports), [feature requests](#feature-requests), [questions](#questions) and submitting [pull requests](#pull-requests).
10
10
 
11
- <a name="bugs"></a>
12
- ## Bug/issue reports
11
+ ## Issue/bug reports
13
12
 
14
- A bug is a _demonstrable problem_ that is caused by the code in the repository.
15
- Good bug reports are extremely helpful - thank you!
13
+ A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you!
16
14
 
17
- Guidelines for bug reports:
15
+ Guidelines for issue/bug reports:
18
16
 
19
17
  1. **Use the GitHub issue search** &mdash; check if the issue has already been reported
20
- 2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `master` or development branch in the repository
21
- 3. Truemail [issue template](.github/ISSUE_TEMPLATE.md)
18
+ 2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `master` or `develop` branch in the repository
19
+ 3. Truemail [issue template](.github/ISSUE_TEMPLATE/issue_report.md)/[bug template](.github/ISSUE_TEMPLATE/bug_report.md)
22
20
 
23
21
  A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
24
22
 
25
- <a name="features"></a>
26
23
  ## Feature requests
27
24
 
28
25
  Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
29
26
 
30
- <a name="pull-requests"></a>
27
+ ## Questions
28
+
29
+ We're always open to a new conversations. So if you have any questions just ask us.
30
+
31
31
  ## Pull requests
32
32
 
33
33
  Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
@@ -39,7 +39,8 @@ Please adhere to the coding conventions used throughout a project (indentation,
39
39
  Guidelines for pull requests:
40
40
 
41
41
  1. Truemail [pull request template](.github/PULL_REQUEST_TEMPLATE.md)
42
- 2. Fork the repo
43
- 3. Run the tests. This is to make sure your starting point works. Tests can be run via ```rspec```
44
- 4. Create a new branch and make your changes. This includes tests for features!
45
- 5. Push to your fork and submit a pull request
42
+ 2. Fork the repo, checkout to `develop` branch
43
+ 3. Run the tests. This is to make sure your starting point works
44
+ 4. Read our [branch naming convention](.github/BRANCH_NAMING_CONVENTION.md)
45
+ 5. Create a new branch and make your changes. This includes tests for features!
46
+ 6. Push to your fork and submit a pull request to `develop` branch
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truemail-rspec (0.1.3)
5
- rspec (~> 3.9)
6
- truemail (~> 1.4, >= 1.4.1)
4
+ truemail-rspec (0.3.1)
5
+ faker (~> 2.15, >= 2.15.1)
6
+ rspec (~> 3.10)
7
+ truemail (~> 2.2)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -14,23 +15,27 @@ GEM
14
15
  thor (>= 0.18, < 2)
15
16
  byebug (11.1.3)
16
17
  childprocess (4.0.0)
17
- coderay (1.1.2)
18
+ coderay (1.1.3)
18
19
  colorize (0.8.1)
19
- diff-lcs (1.3)
20
+ concurrent-ruby (1.1.7)
21
+ diff-lcs (1.4.4)
20
22
  docile (1.3.2)
23
+ faker (2.15.1)
24
+ i18n (>= 1.6, < 2)
21
25
  fasterer (0.8.3)
22
26
  colorize (~> 0.7)
23
27
  ruby_parser (>= 3.14.1)
24
- ffaker (2.17.0)
28
+ i18n (1.8.5)
29
+ concurrent-ruby (~> 1.0)
25
30
  iniparse (1.5.0)
26
- json (2.3.0)
31
+ json (2.3.1)
27
32
  kwalify (0.7.2)
28
33
  method_source (1.0.0)
29
- overcommit (0.55.0)
34
+ overcommit (0.57.0)
30
35
  childprocess (>= 0.6.3, < 5)
31
36
  iniparse (~> 1.4)
32
- parallel (1.19.2)
33
- parser (2.7.1.4)
37
+ parallel (1.20.1)
38
+ parser (2.7.2.0)
34
39
  ast (~> 2.4.1)
35
40
  pry (0.13.1)
36
41
  coderay (~> 1.1)
@@ -38,46 +43,50 @@ GEM
38
43
  pry-byebug (3.9.0)
39
44
  byebug (~> 11.0)
40
45
  pry (~> 0.13.0)
41
- psych (3.1.0)
46
+ psych (3.2.0)
42
47
  rainbow (3.0.0)
43
48
  rake (13.0.1)
44
- reek (6.0.1)
49
+ reek (6.0.2)
45
50
  kwalify (~> 0.7.0)
46
51
  parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
47
- psych (~> 3.1.0)
52
+ psych (~> 3.1)
48
53
  rainbow (>= 2.0, < 4.0)
49
- regexp_parser (1.7.1)
54
+ regexp_parser (2.0.0)
50
55
  rexml (3.2.4)
51
- rspec (3.9.0)
52
- rspec-core (~> 3.9.0)
53
- rspec-expectations (~> 3.9.0)
54
- rspec-mocks (~> 3.9.0)
55
- rspec-core (3.9.2)
56
- rspec-support (~> 3.9.3)
57
- rspec-expectations (3.9.1)
56
+ rspec (3.10.0)
57
+ rspec-core (~> 3.10.0)
58
+ rspec-expectations (~> 3.10.0)
59
+ rspec-mocks (~> 3.10.0)
60
+ rspec-core (3.10.0)
61
+ rspec-support (~> 3.10.0)
62
+ rspec-expectations (3.10.0)
58
63
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.9.0)
60
- rspec-mocks (3.9.1)
64
+ rspec-support (~> 3.10.0)
65
+ rspec-mocks (3.10.0)
61
66
  diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.9.0)
63
- rspec-support (3.9.3)
64
- rubocop (0.89.1)
67
+ rspec-support (~> 3.10.0)
68
+ rspec-support (3.10.0)
69
+ rubocop (1.5.2)
65
70
  parallel (~> 1.10)
66
- parser (>= 2.7.1.1)
71
+ parser (>= 2.7.1.5)
67
72
  rainbow (>= 2.2.2, < 4.0)
68
- regexp_parser (>= 1.7)
73
+ regexp_parser (>= 1.8, < 3.0)
69
74
  rexml
70
- rubocop-ast (>= 0.3.0, < 1.0)
75
+ rubocop-ast (>= 1.2.0, < 2.0)
71
76
  ruby-progressbar (~> 1.7)
72
77
  unicode-display_width (>= 1.4.0, < 2.0)
73
- rubocop-ast (0.3.0)
74
- parser (>= 2.7.1.4)
75
- rubocop-rspec (1.43.1)
76
- rubocop (~> 0.87)
78
+ rubocop-ast (1.3.0)
79
+ parser (>= 2.7.1.5)
80
+ rubocop-performance (1.9.1)
81
+ rubocop (>= 0.90.0, < 2.0)
82
+ rubocop-ast (>= 0.4.0)
83
+ rubocop-rspec (2.0.1)
84
+ rubocop (~> 1.0)
85
+ rubocop-ast (>= 1.1.0)
77
86
  ruby-progressbar (1.10.1)
78
- ruby_parser (3.14.2)
87
+ ruby_parser (3.15.0)
79
88
  sexp_processor (~> 4.9)
80
- sexp_processor (4.14.1)
89
+ sexp_processor (4.15.1)
81
90
  simplecov (0.17.1)
82
91
  docile (~> 1.1)
83
92
  json (>= 1.8, < 3)
@@ -86,7 +95,7 @@ GEM
86
95
  simpleidn (0.1.1)
87
96
  unf (~> 0.1.4)
88
97
  thor (1.0.1)
89
- truemail (1.6.1)
98
+ truemail (2.2.0)
90
99
  simpleidn (~> 0.1.1)
91
100
  unf (0.1.4)
92
101
  unf_ext
@@ -99,15 +108,16 @@ PLATFORMS
99
108
  DEPENDENCIES
100
109
  bundler (~> 1.16)
101
110
  bundler-audit (~> 0.7.0.1)
111
+ faker (~> 2.15, >= 2.15.1)
102
112
  fasterer (~> 0.8.3)
103
- ffaker (~> 2.17)
104
- overcommit (~> 0.55.0)
113
+ overcommit (~> 0.57.0)
105
114
  pry-byebug (~> 3.9)
106
115
  rake (~> 13.0, >= 13.0.1)
107
- reek (~> 6.0, >= 6.0.1)
108
- rspec (~> 3.9)
109
- rubocop (~> 0.89.1)
110
- rubocop-rspec (~> 1.43, >= 1.43.1)
116
+ reek (~> 6.0, >= 6.0.2)
117
+ rspec (~> 3.10)
118
+ rubocop (~> 1.5, >= 1.5.2)
119
+ rubocop-performance (~> 1.9, >= 1.9.1)
120
+ rubocop-rspec (~> 2.0, >= 2.0.1)
111
121
  simplecov (~> 0.17.1)
112
122
  truemail-rspec!
113
123
 
data/README.md CHANGED
@@ -1,8 +1,17 @@
1
- # <img src='https://repository-images.githubusercontent.com/222414074/393c9600-09f9-11ea-8d21-345619b97b11' height='250' alt='Truemail RSpec helpers' />
1
+ # ![Truemail RSpec helpers](https://truemail-rb.org/assets/images/truemail_logo.png)
2
2
 
3
- [![Maintainability](https://api.codeclimate.com/v1/badges/d23d82c1c1bdbc271b81/maintainability)](https://codeclimate.com/github/truemail-rb/truemail-rspec/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/d23d82c1c1bdbc271b81/test_coverage)](https://codeclimate.com/github/truemail-rb/truemail-rspec/test_coverage) [![CircleCI](https://circleci.com/gh/truemail-rb/truemail-rspec/tree/master.svg?style=svg)](https://circleci.com/gh/truemail-rb/truemail-rspec/tree/master) [![Gem Version](https://badge.fury.io/rb/truemail-rspec.svg)](https://badge.fury.io/rb/truemail-rspec) [![Downloads](https://img.shields.io/gem/dt/truemail-rspec.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/truemail-rspec) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/d23d82c1c1bdbc271b81/maintainability)](https://codeclimate.com/github/truemail-rb/truemail-rspec/maintainability)
4
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/d23d82c1c1bdbc271b81/test_coverage)](https://codeclimate.com/github/truemail-rb/truemail-rspec/test_coverage)
5
+ [![CircleCI](https://circleci.com/gh/truemail-rb/truemail-rspec/tree/master.svg?style=svg)](https://circleci.com/gh/truemail-rb/truemail-rspec/tree/master)
6
+ [![Gem Version](https://badge.fury.io/rb/truemail-rspec.svg)](https://badge.fury.io/rb/truemail-rspec)
7
+ [![Downloads](https://img.shields.io/gem/dt/truemail-rspec.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/truemail-rspec)
8
+ [![Gitter](https://badges.gitter.im/truemail-rb/community.svg)](https://gitter.im/truemail-rb/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
9
+ [![GitHub](https://img.shields.io/github/license/truemail-rb/truemail-rspec)](LICENSE.txt)
10
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
4
11
 
5
- `truemail-rspec` gem helps you create `Truemail::Configuration` and `Truemail::Validator` instances for your RSpec environment.
12
+ `truemail-rspec` gem helps you to create `Truemail::Configuration`, `Truemail::Auditor` and `Truemail::Validator` instances for your RSpec environment.
13
+
14
+ > Actual and maintainable documentation :books: for developers is living [here](https://truemail-rb.org/truemail-rspec).
6
15
 
7
16
  ## Table of Contents
8
17
 
@@ -13,9 +22,11 @@
13
22
  - [Create configuration instance](#create-configuration-instance)
14
23
  - [Configuration instance with default random params](#configuration-instance-with-default-random-params)
15
24
  - [Configuration instance with predefined params](#configuration-instance-with-predefined-params)
25
+ - [Create auditor instance](#create-auditor-instance)
26
+ - [create_auditor](#create-auditor)
16
27
  - [Create validator instance](#create-validator-instance)
17
28
  - [create_servers_list](#create_servers_list)
18
- - [create_validator DSL](#create_validator-dsl)
29
+ - [create_validator](#create_validator)
19
30
  - [Truemail family](#truemail-family)
20
31
  - [Contributing](#contributing)
21
32
  - [License](#license)
@@ -31,6 +42,7 @@ Ruby MRI 2.5.0+
31
42
  ## Features
32
43
 
33
44
  - Ability to create `Truemail::Configuration` instance with random or with predefined params
45
+ - Ability to create `Truemail::Auditor` instance with random or with predefined params
34
46
  - Ability to create `Truemail::Validator` instance with random or with predefined params
35
47
 
36
48
  ## Installation
@@ -85,6 +97,23 @@ create_configuration(verifier_email: 'email@domain.com', verifier_domain: 'other
85
97
  # => returns Truemail::Configuration instance with custom settings
86
98
  ```
87
99
 
100
+ ### Create auditor instance
101
+
102
+ Allows to create auditor instance with default random or with predefined params.
103
+
104
+ #### create_auditor
105
+
106
+ ```ruby
107
+ create_auditor(
108
+ success: true, # optional, type:Bool, by default true
109
+ current_host_ip: current_host_ip, # optional, type:String, by default random IPv4 address
110
+ warnings: warnings, # optional, type:Hash, by default creates auditor result warnings
111
+ configuration: create_configuration # optional, type:Truemail::Configuration, by default creates random configuration
112
+ )
113
+
114
+ # => returns Truemail::Auditor instance follow passed params
115
+ ```
116
+
88
117
  ### Create validator instance
89
118
 
90
119
  Allows to create validator instance with default random or with predefined params.
@@ -95,7 +124,7 @@ Allows to create validator instance with default random or with predefined param
95
124
  create_servers_list # => returns array with random ip addresses
96
125
  ```
97
126
 
98
- #### create_validator DSL
127
+ #### create_validator
99
128
 
100
129
  ```ruby
101
130
  create_validator(
@@ -103,6 +132,7 @@ create_validator(
103
132
  email, # optional, type:String, by default random email
104
133
  mail_servers, # optional, type:Array(String), by default array with random ip addresses
105
134
  success: true, # optional, type:Bool, by default true
135
+ rcptto_error: 'custom context of rcptto error' # optional, type:String, by default it's equal to 'user not found'
106
136
  configuration: create_configuration # optional, type:Truemail::Configuration, by default creates random configuration
107
137
  )
108
138
 
@@ -113,15 +143,16 @@ create_validator(
113
143
 
114
144
  ## Truemail family
115
145
 
116
- All Truemail extensions: https://github.com/truemail-rb
146
+ All Truemail solutions: https://truemail-rb.org
117
147
 
118
148
  | Name | Type | Description |
119
149
  | --- | --- | --- |
120
- | [truemail](https://github.com/rubygarage/truemail) | ruby gem | Configurable plain Ruby email validator, main core |
121
- | [truemail server](https://github.com/truemail-rb/truemail-rack) | ruby app | Lightweight rack based web API wrapper for Truemail |
150
+ | [truemail](https://github.com/truemail-rb/truemail) | ruby gem | Configurable framework agnostic plain Ruby email validator, main core |
151
+ | [truemail server](https://github.com/truemail-rb/truemail-rack) | ruby app | Lightweight rack based web API wrapper for Truemail gem |
122
152
  | [truemail-rack-docker](https://github.com/truemail-rb/truemail-rack-docker-image) | docker image | Lightweight rack based web API [dockerized image](https://hub.docker.com/r/truemail/truemail-rack) :whale: of Truemail server |
123
- | [truemail-ruby-client](https://github.com/truemail-rb/truemail-ruby-client) | ruby gem | Truemail web API client library for Ruby |
124
- | [truemail-crystal-client](https://github.com/truemail-rb/truemail-crystal-client) | crystal shard | Truemail web API client library for Crystal |
153
+ | [truemail-ruby-client](https://github.com/truemail-rb/truemail-ruby-client) | ruby gem | Web API Ruby client for Truemail Server |
154
+ | [truemail-crystal-client](https://github.com/truemail-rb/truemail-crystal-client) | crystal shard | Web API Crystal client for Truemail Server |
155
+ | [truemail-java-client](https://github.com/truemail-rb/truemail-java-client) | java lib | Web API Java client for Truemail Server |
125
156
 
126
157
  ## Contributing
127
158
 
@@ -2,11 +2,13 @@
2
2
 
3
3
  require 'truemail/rspec/version'
4
4
  require 'truemail/rspec/configuration_helper'
5
+ require 'truemail/rspec/auditor_helper'
5
6
  require 'truemail/rspec/validator_helper'
6
7
 
7
8
  module Truemail
8
9
  module RSpec
9
10
  include Truemail::RSpec::ConfigurationHelper
11
+ include Truemail::RSpec::AuditorHelper
10
12
  include Truemail::RSpec::ValidatorHelper
11
13
  end
12
14
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Truemail
4
+ module RSpec
5
+ module AuditorHelper
6
+ def create_auditor(
7
+ success: true,
8
+ current_host_ip: ::Faker::Internet.ip_v4_address,
9
+ warnings: { ip: Truemail::Audit::Ip::IPIFY_ERROR },
10
+ configuration: create_configuration
11
+ )
12
+ Truemail::Auditor.new(configuration: configuration).tap do |auditor|
13
+ auditor_result = auditor.result
14
+ auditor_result.current_host_ip = current_host_ip if success
15
+ auditor_result.warnings = warnings unless success
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -12,8 +12,8 @@ module Truemail
12
12
  end
13
13
 
14
14
  def create_configuration(**configuration_settings)
15
- configuration_settings[:verifier_email] = FFaker::Internet.email unless configuration_settings[:verifier_email]
16
- Truemail::Configuration.new(&configuration_block(configuration_settings))
15
+ configuration_settings[:verifier_email] = ::Faker::Internet.email unless configuration_settings[:verifier_email]
16
+ Truemail::Configuration.new(&configuration_block(**configuration_settings))
17
17
  end
18
18
  end
19
19
  end
@@ -4,17 +4,18 @@ module Truemail
4
4
  module RSpec
5
5
  module ValidatorHelper
6
6
  def create_servers_list
7
- Array.new(rand(1..4)) { FFaker::Internet.ip_v4_address }
7
+ Array.new(rand(1..4)) { ::Faker::Internet.ip_v4_address }
8
8
  end
9
9
 
10
- def create_validator(
10
+ def create_validator( # rubocop:disable Metrics/ParameterLists
11
11
  validation_type = nil,
12
- email = FFaker::Internet.email,
12
+ email = ::Faker::Internet.email,
13
13
  mail_servers = create_servers_list,
14
+ rcptto_error: 'user not found',
14
15
  success: true,
15
16
  configuration: create_configuration
16
17
  )
17
- set_expected_result(validation_type, email, mail_servers, success, configuration)
18
+ set_expected_result(validation_type, email, mail_servers, success, configuration, rcptto_error)
18
19
  stub_validation_layers
19
20
  validator_instance = ValidatorFactory.call(validation_type, success, email, configuration)
20
21
  unstub_validation_layers
@@ -23,14 +24,15 @@ module Truemail
23
24
 
24
25
  private
25
26
 
26
- attr_reader :validation_type, :email, :success, :configuration, :mail_servers
27
+ attr_reader :validation_type, :email, :success, :configuration, :mail_servers, :rcptto_error
27
28
 
28
- def set_expected_result(validation_type, email, mail_servers, success, configuration)
29
+ def set_expected_result(validation_type, email, mail_servers, success, configuration, rcptto_error) # rubocop:disable Metrics/ParameterLists
29
30
  @validation_type = validation_type
30
31
  @email = email
31
32
  @mail_servers = mail_servers
32
33
  @success = success
33
34
  @configuration = configuration
35
+ @rcptto_error = rcptto_error
34
36
  end
35
37
 
36
38
  def stub_validation_layers
@@ -74,7 +76,7 @@ module Truemail
74
76
  response.helo = true
75
77
  response.mailfrom = true
76
78
  response.rcptto = false
77
- response.errors[:rcptto] = 'user not found'
79
+ response.errors[:rcptto] = rcptto_error
78
80
  end
79
81
 
80
82
  request