truemail-rspec 0.1.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,64 @@
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.1] - 2020-12-06
5
+
6
+ ### Added
7
+
8
+ - Required `faker` runtime dependency
9
+
10
+ ## [0.3.0] - 2020-12-06
11
+
12
+ ### Added
13
+
14
+ Ability to pass custom context into rcptto error:
15
+
16
+ ```ruby
17
+ create_validator(
18
+ validation_type, # optional, type:Symbol, can be :regex, :mx or :smtp, by default creates :smtp validation
19
+ email, # optional, type:String, by default random email
20
+ mail_servers, # optional, type:Array(String), by default array with random ip addresses
21
+ success: true, # optional, type:Bool, by default true
22
+ rcptto_error: 'custom context of rcptto error' # optional, type:String, by default it's equal to 'user not found'
23
+ configuration: create_configuration # optional, type:Truemail::Configuration, by default creates random configuration
24
+ )
25
+ ```
26
+
27
+ ### Changed
28
+
29
+ - Updated `Truemail::RSpec::ValidatorHelper`
30
+ - gem development, runtime dependencies
31
+ - gem documentation
32
+
33
+ ## [0.2.1] - 2020-09-21
34
+
35
+ ### Changed
36
+
37
+ Migrated to updated Ruby 2.7.x syntax.
38
+
39
+ - Updated `Truemail::RSpec::ConfigurationHelper`
40
+
41
+ ## [0.2.0] - 2020-08-31
42
+
43
+ ### Added
44
+
45
+ - auditor RSpec helper
46
+
47
+ ### Removed
48
+
49
+ - gem public documentation
50
+
51
+ ## [0.1.3] - 2020-08-24
52
+
53
+ ### Added
54
+
55
+ - gem public documentation
56
+
57
+ ### Changed
58
+
59
+ - gem development dependencies
60
+ - linters configs
61
+
4
62
  ## [0.1.2] - 2020-05-08
5
63
 
6
64
  ### Changed
@@ -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,78 +1,92 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truemail-rspec (0.1.2)
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/
10
11
  specs:
11
- ast (2.4.0)
12
- bundler-audit (0.6.1)
12
+ ast (2.4.1)
13
+ bundler-audit (0.7.0.1)
13
14
  bundler (>= 1.2.0, < 3)
14
- thor (~> 0.18)
15
+ thor (>= 0.18, < 2)
15
16
  byebug (11.1.3)
16
- childprocess (3.0.0)
17
- coderay (1.1.2)
17
+ childprocess (4.0.0)
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.14.0)
28
+ i18n (1.8.5)
29
+ concurrent-ruby (~> 1.0)
25
30
  iniparse (1.5.0)
26
- jaro_winkler (1.5.4)
27
- json (2.3.0)
31
+ json (2.3.1)
28
32
  kwalify (0.7.2)
29
33
  method_source (1.0.0)
30
- overcommit (0.53.0)
31
- childprocess (>= 0.6.3, < 4)
34
+ overcommit (0.57.0)
35
+ childprocess (>= 0.6.3, < 5)
32
36
  iniparse (~> 1.4)
33
- parallel (1.19.1)
34
- parser (2.7.1.2)
35
- ast (~> 2.4.0)
37
+ parallel (1.20.1)
38
+ parser (2.7.2.0)
39
+ ast (~> 2.4.1)
36
40
  pry (0.13.1)
37
41
  coderay (~> 1.1)
38
42
  method_source (~> 1.0)
39
43
  pry-byebug (3.9.0)
40
44
  byebug (~> 11.0)
41
45
  pry (~> 0.13.0)
42
- psych (3.1.0)
46
+ psych (3.2.0)
43
47
  rainbow (3.0.0)
44
48
  rake (13.0.1)
45
- reek (6.0.0)
49
+ reek (6.0.2)
46
50
  kwalify (~> 0.7.0)
47
51
  parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
48
- psych (~> 3.1.0)
52
+ psych (~> 3.1)
49
53
  rainbow (>= 2.0, < 4.0)
50
- rspec (3.9.0)
51
- rspec-core (~> 3.9.0)
52
- rspec-expectations (~> 3.9.0)
53
- rspec-mocks (~> 3.9.0)
54
- rspec-core (3.9.2)
55
- rspec-support (~> 3.9.3)
56
- rspec-expectations (3.9.1)
54
+ regexp_parser (2.0.0)
55
+ rexml (3.2.4)
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)
57
63
  diff-lcs (>= 1.2.0, < 2.0)
58
- rspec-support (~> 3.9.0)
59
- rspec-mocks (3.9.1)
64
+ rspec-support (~> 3.10.0)
65
+ rspec-mocks (3.10.0)
60
66
  diff-lcs (>= 1.2.0, < 2.0)
61
- rspec-support (~> 3.9.0)
62
- rspec-support (3.9.3)
63
- rubocop (0.76.0)
64
- jaro_winkler (~> 1.5.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.6)
71
+ parser (>= 2.7.1.5)
67
72
  rainbow (>= 2.2.2, < 4.0)
73
+ regexp_parser (>= 1.8, < 3.0)
74
+ rexml
75
+ rubocop-ast (>= 1.2.0, < 2.0)
68
76
  ruby-progressbar (~> 1.7)
69
- unicode-display_width (>= 1.4.0, < 1.7)
70
- rubocop-rspec (1.39.0)
71
- rubocop (>= 0.68.1)
77
+ unicode-display_width (>= 1.4.0, < 2.0)
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)
72
86
  ruby-progressbar (1.10.1)
73
- ruby_parser (3.14.2)
87
+ ruby_parser (3.15.0)
74
88
  sexp_processor (~> 4.9)
75
- sexp_processor (4.14.1)
89
+ sexp_processor (4.15.1)
76
90
  simplecov (0.17.1)
77
91
  docile (~> 1.1)
78
92
  json (>= 1.8, < 3)
@@ -80,29 +94,30 @@ GEM
80
94
  simplecov-html (0.10.2)
81
95
  simpleidn (0.1.1)
82
96
  unf (~> 0.1.4)
83
- thor (0.20.3)
84
- truemail (1.6.1)
97
+ thor (1.0.1)
98
+ truemail (2.2.0)
85
99
  simpleidn (~> 0.1.1)
86
100
  unf (0.1.4)
87
101
  unf_ext
88
102
  unf_ext (0.0.7.7)
89
- unicode-display_width (1.6.1)
103
+ unicode-display_width (1.7.0)
90
104
 
91
105
  PLATFORMS
92
106
  ruby
93
107
 
94
108
  DEPENDENCIES
95
109
  bundler (~> 1.16)
96
- bundler-audit (~> 0.6.1)
110
+ bundler-audit (~> 0.7.0.1)
111
+ faker (~> 2.15, >= 2.15.1)
97
112
  fasterer (~> 0.8.3)
98
- ffaker (~> 2.14)
99
- overcommit (~> 0.53.0)
113
+ overcommit (~> 0.57.0)
100
114
  pry-byebug (~> 3.9)
101
115
  rake (~> 13.0, >= 13.0.1)
102
- reek (~> 6.0)
103
- rspec (~> 3.9)
104
- rubocop (~> 0.76.0)
105
- rubocop-rspec (~> 1.36)
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)
106
121
  simplecov (~> 0.17.1)
107
122
  truemail-rspec!
108
123
 
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Vladislav Trotsenko
3
+ Copyright (c) 2020 Vladislav Trotsenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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,11 +42,12 @@ 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
37
49
 
38
- Add this line to your application's Gemfile:
50
+ Add this line to your application's `Gemfile`:
39
51
 
40
52
  ```ruby
41
53
  group :development, :test do
@@ -65,7 +77,7 @@ Or install it yourself as:
65
77
 
66
78
  ### Create configuration instance
67
79
 
68
- Allow to create configuration instance with random or with predefined params.
80
+ Allows to create configuration instance with random or with predefined params.
69
81
 
70
82
  #### Configuration instance with default random params
71
83
 
@@ -85,9 +97,26 @@ 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
- Allow to create validator instance with default random or with predefined params.
119
+ Allows to create validator instance with default random or with predefined params.
91
120
 
92
121
  #### create_servers_list
93
122
 
@@ -95,7 +124,7 @@ Allow to create validator instance with default random or with predefined params
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