smtp_mock 1.2.2 → 1.3.1

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.
data/.reek.yml DELETED
@@ -1,31 +0,0 @@
1
- detectors:
2
- IrresponsibleModule:
3
- enabled: false
4
-
5
- UtilityFunction:
6
- exclude:
7
- - SmtpMock::CommandLineArgsBuilder#to_camel_case
8
- - SmtpMock::DependencyHelper#compose_command
9
- - SmtpMock::ServerHelper
10
- - SmtpMock::TestFramework::RSpec::Helper#smtp_mock_server
11
- - SmtpMock::ContextGeneratorHelper#random_message
12
- - SmtpMock::Cli::Resolver#install_to
13
-
14
- NestedIterators:
15
- exclude:
16
- - SmtpMock::CommandLineArgsBuilder#define_attribute
17
-
18
- TooManyStatements:
19
- exclude:
20
- - SmtpMock::Server#run
21
- - SmtpMock::ServerHelper#create_fake_servers
22
- - SmtpMock::Cli::Resolver#install
23
- - SmtpMock::Cli::Resolver#resolve
24
-
25
- TooManyInstanceVariables:
26
- exclude:
27
- - SmtpMock::Server
28
-
29
- LongParameterList:
30
- exclude:
31
- - SmtpMock::ClientHelper#smtp_request
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --require spec_helper
2
- --format documentation
3
- --color
data/.rubocop.yml DELETED
@@ -1,123 +0,0 @@
1
- require:
2
- - rubocop-rspec
3
- - rubocop-performance
4
-
5
- AllCops:
6
- DisplayCopNames: true
7
- DisplayStyleGuide: true
8
- TargetRubyVersion: 2.5
9
- NewCops: enable
10
-
11
- # Metrics ---------------------------------------------------------------------
12
-
13
- Metrics/ClassLength:
14
- Max: 150
15
-
16
- Metrics/MethodLength:
17
- Max: 15
18
-
19
- Metrics/BlockLength:
20
- Enabled: false
21
-
22
- Metrics/CyclomaticComplexity:
23
- Enabled: false
24
-
25
- Metrics/PerceivedComplexity:
26
- Enabled: false
27
-
28
- # Naming ----------------------------------------------------------------------
29
-
30
- Naming/VariableNumber:
31
- Enabled: false
32
-
33
- Naming/RescuedExceptionsVariableName:
34
- Enabled: false
35
-
36
- Naming/InclusiveLanguage:
37
- Enabled: false
38
-
39
- # Style -----------------------------------------------------------------------
40
-
41
- Style/Documentation:
42
- Enabled: false
43
-
44
- Style/DoubleNegation:
45
- Enabled: false
46
-
47
- Style/EmptyCaseCondition:
48
- Enabled: false
49
-
50
- Style/ParallelAssignment:
51
- Enabled: false
52
-
53
- Style/RescueStandardError:
54
- Enabled: false
55
-
56
- # Layout ----------------------------------------------------------------------
57
-
58
- Layout/LineLength:
59
- Max: 150
60
-
61
- Layout/ClassStructure:
62
- Enabled: true
63
- Categories:
64
- module_inclusion:
65
- - include
66
- - prepend
67
- - extend
68
- ExpectedOrder:
69
- - module_inclusion
70
- - constants
71
- - public_class_methods
72
- - initializer
73
- - public_methods
74
- - protected_methods
75
- - private_methods
76
-
77
- Layout/EmptyLineAfterGuardClause:
78
- Enabled: false
79
-
80
- # Gemspec ---------------------------------------------------------------------
81
-
82
- Gemspec/RequireMFA:
83
- Enabled: false
84
-
85
- # Performance -----------------------------------------------------------------
86
-
87
- Performance/MethodObjectAsBlock:
88
- Enabled: false
89
-
90
- # RSpec -----------------------------------------------------------------------
91
-
92
- RSpec/ExampleLength:
93
- Enabled: false
94
-
95
- RSpec/NestedGroups:
96
- Enabled: false
97
-
98
- RSpec/MultipleExpectations:
99
- Enabled: false
100
-
101
- RSpec/MessageChain:
102
- Enabled: false
103
-
104
- RSpec/ContextWording:
105
- Enabled: false
106
-
107
- RSpec/AnyInstance:
108
- Enabled: false
109
-
110
- RSpec/MessageSpies:
111
- Enabled: false
112
-
113
- RSpec/MultipleDescribes:
114
- Enabled: false
115
-
116
- RSpec/MultipleMemoizedHelpers:
117
- Enabled: false
118
-
119
- RSpec/StubbedMock:
120
- Enabled: false
121
-
122
- RSpec/VerifiedDoubleReference:
123
- Enabled: false
data/.ruby-gemset DELETED
@@ -1 +0,0 @@
1
- smtp_mock
data/CHANGELOG.md DELETED
@@ -1,104 +0,0 @@
1
- # Changelog
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).
4
-
5
- ## [1.2.2] - 2022-10-05
6
-
7
- ### Fixed
8
-
9
- - Fixed wrong semantic version comparison in `SmtpMock::Dependency#minimal_version?`
10
-
11
- ### Updated
12
-
13
- - Updated gemspecs
14
- - Updated tests
15
- - Updated codeclimate/circleci configs
16
- - Updated gem development dependencies
17
- - Updated gem version
18
-
19
- ## [1.2.1] - 2022-07-27
20
-
21
- ### Fixed
22
-
23
- - Fixed documentation
24
-
25
- ### Updated
26
-
27
- - Updated gem documentation, version
28
-
29
- ## [1.2.0] - 2022-07-27
30
-
31
- ### Added
32
-
33
- - Added ability to use `RSET` SMTP command
34
- - Added ability to configure multiple message receiving flow during one session
35
- - Added ability to configure SMTP command delay responses
36
-
37
- ### Updated
38
-
39
- - Updated gemspecs
40
- - Updated tests
41
- - Updated rubocop/codeclimate/circleci configs
42
- - Updated gem development dependencies
43
- - Updated gem documentation, version
44
-
45
- ## [1.1.0] - 2022-05-17
46
-
47
- ### Added
48
-
49
- - Ability to check `smtpmock` version from cli
50
-
51
- ### Updated
52
-
53
- - Updated gemspecs
54
- - Updated codeclimate/circleci configs
55
- - Updated gem development dependencies
56
- - Updated gem version
57
-
58
- ## [1.0.1] - 2022-03-10
59
-
60
- ### Added
61
-
62
- - Development environment guide
63
-
64
- ### Updated
65
-
66
- - Updated gemspecs
67
- - Updated codeclimate/circleci configs
68
- - Updated gem development dependencies
69
- - Updated gem version
70
-
71
- ## [1.0.0] - 2022-01-31
72
-
73
- ### Added
74
-
75
- - Added `smtpmock` version checker
76
- - Added command for upgrade `smtpmock` to latest version
77
- - Added `SmtpMock::Error::Dependency::SMTPMOCK_MIN_VERSION`
78
- - Added `SmtpMock::Server#version`, tests
79
-
80
- ### Updated
81
-
82
- - Updated `SmtpMock::Dependency.verify_dependencies`, tests
83
- - Updated `SmtpMock::Cli::Command`, tests
84
- - Updated gem version, documentation
85
-
86
- ## [0.1.2] - 2022-01-24
87
-
88
- ### Updated
89
-
90
- - Updated `SmtpMock::Cli::Command`, tests
91
- - Updated gem version, documentation
92
-
93
- ## [0.1.1] - 2022-01-18
94
-
95
- ### Updated
96
-
97
- - Updated gem documentation
98
- - Updated codeclimate config
99
-
100
- ## [0.1.0] - 2022-01-18
101
-
102
- ### Added
103
-
104
- - First release of `SmtpMock`. Thanks [@le0pard](https://github.com/le0pard) for support 🚀
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at admin@bestweb.com.ua. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md DELETED
@@ -1,48 +0,0 @@
1
- # Contributing to SmtpMock
2
-
3
- Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
4
-
5
- Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
6
-
7
- ## Using the issue tracker
8
-
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
-
11
- ## Issue/bug reports
12
-
13
- A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you!
14
-
15
- Guidelines for issue/bug reports:
16
-
17
- 1. **Use the GitHub issue search** — check if the issue has already been reported
18
- 2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or `develop` branch in the repository
19
- 3. SmtpMock [issue template](.github/ISSUE_TEMPLATE/issue_report.md)/[bug template](.github/ISSUE_TEMPLATE/bug_report.md)
20
-
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.
22
-
23
- ## Feature requests
24
-
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.
26
-
27
- ## Questions
28
-
29
- We're always open to a new conversations. So if you have any questions just ask us.
30
-
31
- ## Pull requests
32
-
33
- Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
34
-
35
- **Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
36
-
37
- Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). Not all features proposed will be added but we are open to having a conversation about a feature you are championing.
38
-
39
- Guidelines for pull requests:
40
-
41
- 1. SmtpMock [pull request template](.github/PULL_REQUEST_TEMPLATE.md)
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
46
- 6. Read our [setup development environment guide](.github/DEVELOPMENT_ENVIRONMENT_GUIDE.md)
47
- 7. Make your changes. Please note that your PR should include tests for the new codebase!
48
- 9. Push to your fork and submit a pull request to `develop` branch
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
5
- gemspec
data/README.md DELETED
@@ -1,260 +0,0 @@
1
- # ![Ruby SmtpMock - mimic any 📤 SMTP server behaviour for your test environment with fake SMTP server](https://repository-images.githubusercontent.com/443795043/81ce5b00-0915-4dd0-93ad-88e6699e18cd)
2
-
3
- [![Maintainability](https://api.codeclimate.com/v1/badges/315c5fff7449a11868dd/maintainability)](https://codeclimate.com/github/mocktools/ruby-smtp-mock/maintainability)
4
- [![Test Coverage](https://api.codeclimate.com/v1/badges/315c5fff7449a11868dd/test_coverage)](https://codeclimate.com/github/mocktools/ruby-smtp-mock/test_coverage)
5
- [![CircleCI](https://circleci.com/gh/mocktools/ruby-smtp-mock/tree/master.svg?style=svg)](https://circleci.com/gh/mocktools/ruby-smtp-mock/tree/master)
6
- [![Gem Version](https://badge.fury.io/rb/smtp_mock.svg)](https://badge.fury.io/rb/smtp_mock)
7
- [![Downloads](https://img.shields.io/gem/dt/smtp_mock.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/smtp_mock)
8
- [![GitHub](https://img.shields.io/github/license/mocktools/ruby-smtp-mock)](LICENSE.txt)
9
- [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
10
-
11
- 💎 Ruby SMTP mock - flexible Ruby wrapper over [`smtpmock`](https://github.com/mocktools/go-smtp-mock). Mimic any 📤 SMTP server behaviour for your test environment and even more.
12
-
13
- ## Table of Contents
14
-
15
- - [Features](#features)
16
- - [Requirements](#requirements)
17
- - [Installation](#installation)
18
- - [Usage](#usage)
19
- - [Dependency manager](#dependency-manager)
20
- - [Available flags](#available-flags)
21
- - [DSL](#dsl)
22
- - [Available server options](#available-server-options)
23
- - [Example of usage](#example-of-usage)
24
- - [RSpec integration](#rspec-integration)
25
- - [SmtpMock RSpec helper](#smtpmock-rspec-helper)
26
- - [SmtpMock RSpec interface](#smtpmock-rspec-interface)
27
- - [Contributing](#contributing)
28
- - [License](#license)
29
- - [Code of Conduct](#code-of-conduct)
30
- - [Credits](#credits)
31
- - [Versioning](#versioning)
32
- - [Changelog](CHANGELOG.md)
33
-
34
- ## Features
35
-
36
- - Ability to handle configurable behaviour and life cycles of SMTP mock server(s)
37
- - Dynamic/manual port assignment
38
- - Test framework agnostic (it's PORO, so you can use it outside of `RSpec`, `Test::Unit` or `MiniTest`)
39
- - Simple and intuitive DSL
40
- - RSpec integration out of the box
41
- - Includes easy system dependency manager
42
-
43
- ## Requirements
44
-
45
- Ruby MRI 2.5.0+
46
-
47
- ## Installation
48
-
49
- Add this line to your application's `Gemfile`:
50
-
51
- ```ruby
52
- group :development, :test do
53
- gem 'smtp_mock', require: false
54
- end
55
- ```
56
-
57
- And then execute:
58
-
59
- $ bundle
60
-
61
- Or install it yourself as:
62
-
63
- $ gem install smtp_mock
64
-
65
- Then install [`smtpmock`](https://github.com/mocktools/go-smtp-mock) as system dependency:
66
-
67
- $ bundle exec smtp_mock -i ~
68
-
69
- ## Usage
70
-
71
- ### Dependency manager
72
-
73
- This gem includes easy system dependency manager. Run `bundle exec smtp_mock` with options for manage `smtpmock` system dependency.
74
-
75
- #### Available flags
76
-
77
- | Flag | Description | Example of usage |
78
- | --- | --- | --- |
79
- | `-s`, `--sudo` | Run command as sudo | `bundle exec smtp_mock -s -i ~` |
80
- | `-i`, `--install=PATH` | Install `smtpmock` to the existing path | `bundle exec smtp_mock -i ~/existent_dir` |
81
- | `-u`, `--uninstall` | Uninstall `smtpmock` | `bundle exec smtp_mock -u` |
82
- | `-g`, `--upgrade` | Upgrade to latest version of `smtpmock` | `bundle exec smtp_mock -g` |
83
- | `-v`, `--version` | Prints current version of `smtpmock` | `bundle exec smtp_mock -v` |
84
- | `-h`, `--help` | Prints help | `bundle exec smtp_mock -h` |
85
-
86
- ### DSL
87
-
88
- #### Available server options
89
-
90
- | Example of usage kwarg | Description |
91
- | --- | --- |
92
- | `host: '0.0.0.0'` | Host address where smtpmock will run. It's equal to 127.0.0.1 by default |
93
- | `port: 2525` | Server port number. If not specified it will be assigned dynamically |
94
- | `log: true` | Enables log server activity. Disabled by default |
95
- | `session_timeout: 60` | Session timeout in seconds. It's equal to 30 seconds by default |
96
- | `shutdown_timeout: 5` | Graceful shutdown timeout in seconds. It's equal to 1 second by default |
97
- | `fail_fast: true` | Enables fail fast scenario. Disabled by default |
98
- | `multiple_message_receiving: true` | Enables multiple message receiving scenario. Disabled by default |
99
- | `blacklisted_helo_domains: %w[a.com b.com]` | Blacklisted `HELO` domains |
100
- | `blacklisted_mailfrom_emails: %w[a@a.com b@b.com]` | Blacklisted `MAIL FROM` emails |
101
- | `blacklisted_rcptto_emails: %w[c@c.com d@d.com]` | blacklisted `RCPT TO` emails |
102
- | `not_registered_emails: %w[e@e.com f@f.com]` | Not registered (non-existent) `RCPT TO` emails |
103
- | `response_delay_helo: 2` | `HELO` response delay in seconds. It's equal to 0 seconds by default |
104
- | `response_delay_mailfrom: 2` | `MAIL FROM` response delay in seconds. It's equal to 0 seconds by default |
105
- | `response_delay_rcptto: 2` | `RCPT TO` response delay in seconds. It's equal to 0 seconds by default |
106
- | `response_delay_data: 2` | `DATA` response delay in seconds. It's equal to 0 seconds by default |
107
- | `response_delay_message: 2` | Message response delay in seconds. It's equal to 0 seconds by default |
108
- | `response_delay_rset: 2` | `RSET` response delay in seconds. It's equal to 0 seconds by default |
109
- | `response_delay_quit: 2` | `QUIT` response delay in seconds. It's equal to 0 seconds by default |
110
- | `msg_size_limit: 42` | Message body size limit in bytes. It's equal to 10485760 bytes by default |
111
- | `msg_greeting: 'Greeting message'` | Custom server greeting message |
112
- | `msg_invalid_cmd: 'Invalid command message'` | Custom invalid command message |
113
- | `msg_invalid_cmd_helo_sequence: 'Invalid command HELO sequence message'` | Custom invalid command `HELO` sequence message |
114
- | `msg_invalid_cmd_helo_arg: 'Invalid command HELO argument message'` | Custom invalid command `HELO` argument message |
115
- | `msg_helo_blacklisted_domain: 'Blacklisted domain message'` | Custom `HELO` blacklisted domain message |
116
- | `msg_helo_received: 'HELO received message'` | Custom `HELO` received message |
117
- | `msg_invalid_cmd_mailfrom_sequence: 'Invalid command MAIL FROM sequence message'` | Custom invalid command `MAIL FROM` sequence message |
118
- | `msg_invalid_cmd_mailfrom_arg: 'Invalid command MAIL FROM argument message'` | Custom invalid command `MAIL FROM` argument message |
119
- | `msg_mailfrom_blacklisted_email: 'Blacklisted email message'` | Custom `MAIL FROM` blacklisted email message |
120
- | `msg_mailfrom_received: 'MAIL FROM received message'` | Custom `MAIL FROM` received message |
121
- | `msg_invalid_cmd_rcptto_sequence: 'Invalid command RCPT TO sequence message'` | Custom invalid command `RCPT TO` sequence message |
122
- | `msg_invalid_cmd_rcptto_arg: 'Invalid command RCPT TO argument message'` | Custom invalid command `RCPT TO` argument message |
123
- | `msg_rcptto_not_registered_email: 'Not registered email message'` | Custom `RCPT TO` not registered email message |
124
- | `msg_rcptto_blacklisted_email: 'Blacklisted email message'` | Custom `RCPT TO` blacklisted email message |
125
- | `msg_rcptto_received: 'RCPT TO received message'` | Custom `RCPT TO` received message |
126
- | `msg_invalid_cmd_data_sequence: 'Invalid command DATA sequence message'` | Custom invalid command `DATA` sequence message |
127
- | `msg_data_received: 'DATA received message'` | Custom `DATA` received message |
128
- | `msg_msg_size_is_too_big: 'Message size is too big'` | Custom size is too big message |
129
- | `msg_invalid_cmd_rset_sequence: 'Invalid command RSET sequence message'` | Custom invalid command `RSET` sequence message |
130
- | `msg_invalid_cmd_rset_arg: 'Invalid command RSET argument message'` | Custom invalid command `RSET` argument message |
131
- | `msg_rset_received: 'RSET received message'` | Custom `RSET` received message |
132
- | `msg_quit_cmd: 'Quit command message'` | Custom quit command message |
133
-
134
- #### Example of usage
135
-
136
- ```ruby
137
- # Public SmtpMock interface
138
- # Without kwargs creates SMTP mock server with default behaviour.
139
- # A free port for server will be randomly assigned in the range
140
- # from 49152 to 65535. Returns current smtp mock server instance
141
- smtp_mock_server = SmtpMock.start_server(not_registered_emails: %w[user@example.com]) # => SmtpMock::Server instance
142
-
143
- # returns current smtp mock server port
144
- smtp_mock_server.port # => 55640
145
-
146
- # returns current smtp mock server port
147
- smtp_mock_server.pid # => 38195
148
-
149
- # returns current smtp mock server version
150
- smtp_mock_server.version # => '1.5.2'
151
-
152
- # interface for graceful shutdown current smtp mock server
153
- smtp_mock_server.stop # => true
154
-
155
- # interface for force shutdown current smtp mock server
156
- smtp_mock_server.stop! # => true
157
-
158
- # interface to check state of current smtp mock server
159
- # returns true if server is running, otherwise returns false
160
- smtp_mock_server.active? # => true
161
-
162
- # returns list of running smtp mock servers
163
- SmtpMock.running_servers # => [SmtpMock::Server instance]
164
-
165
- # interface to stop all running smtp mock servers
166
- SmtpMock.stop_running_servers! # => true
167
- ```
168
-
169
- ### RSpec integration
170
-
171
- Require this either in your Gemfile or in RSpec's support scripts. So either:
172
-
173
- ```ruby
174
- # Gemfile
175
-
176
- group :test do
177
- gem 'rspec'
178
- gem 'smtp_mock', require: 'smtp_mock/test_framework/rspec'
179
- end
180
- ```
181
-
182
- or
183
-
184
- ```ruby
185
- # spec/support/config/smtp_mock.rb
186
-
187
- require 'smtp_mock/test_framework/rspec'
188
- ```
189
-
190
- #### SmtpMock RSpec helper
191
-
192
- Just add `SmtpMock::TestFramework::RSpec::Helper` if you wanna use shortcut `smtp_mock_server` for SmtpMock server instance inside of your `RSpec.describe` blocks:
193
-
194
- ```ruby
195
- # spec/support/config/smtp_mock.rb
196
-
197
- RSpec.configure do |config|
198
- config.include SmtpMock::TestFramework::RSpec::Helper
199
- end
200
- ```
201
-
202
- ```ruby
203
- # your awesome smtp_client_spec.rb
204
-
205
- RSpec.describe SmtpClient do
206
- subject(:smtp_response) do
207
- described_class.call(
208
- host: 'localhost',
209
- port: smtp_mock_server.port,
210
- mailfrom: mailfrom,
211
- rcptto: rcptto,
212
- message: message
213
- )
214
- end
215
-
216
- let(:mailfrom) { 'sender@example.com' }
217
- let(:rcptto) { 'receiver@example.com' }
218
- let(:message) { 'Email message context' }
219
- let(:expected_response_message) { '250 Custom successful response' }
220
-
221
- before { smtp_mock_server(msg_msg_received: expected_response_message) }
222
-
223
- it do
224
- expect(smtp_response).to be_success
225
- expect(smtp_response).to have_status(expected_response_status)
226
- expect(smtp_response).to have_message_context(expected_response_message)
227
- end
228
- end
229
- ```
230
-
231
- #### SmtpMock RSpec interface
232
-
233
- If you won't use `SmtpMock::TestFramework::RSpec::Helper` you can use `SmtpMock::TestFramework::RSpec::Interface` directly instead:
234
-
235
- ```ruby
236
- SmtpMock::TestFramework::RSpec::Interface.start_server # creates and runs SmtpMock server instance
237
- SmtpMock::TestFramework::RSpec::Interface.stop_server! # stops and clears current SmtpMock server instance
238
- SmtpMock::TestFramework::RSpec::Interface.clear_server! # clears current SmtpMock server instance
239
- ```
240
-
241
- ## Contributing
242
-
243
- Bug reports and pull requests are welcome on GitHub at https://github.com/mocktools/ruby-smtp-mock. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. Please check the [open tickets](https://github.com/mocktools/ruby-smtp-mock/issues). Be sure to follow Contributor Code of Conduct below and our [Contributing Guidelines](CONTRIBUTING.md).
244
-
245
- ## License
246
-
247
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
248
-
249
- ## Code of Conduct
250
-
251
- Everyone interacting in the SmtpMock project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).
252
-
253
- ## Credits
254
-
255
- - [The Contributors](https://github.com/mocktools/ruby-smtp-mock/graphs/contributors) for code and awesome suggestions
256
- - [The Stargazers](https://github.com/mocktools/ruby-smtp-mock/stargazers) for showing their support
257
-
258
- ## Versioning
259
-
260
- SmtpMock uses [Semantic Versioning 2.0.0](https://semver.org)
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec