-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from mocktools/develop
Ruby SmtpMock v1.3.5
- Loading branch information
Showing
26 changed files
with
203 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers. | |
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the project team at [email protected]. All | ||
reported by contacting the project team at <[email protected]>. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an incident. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module SmtpMock | ||
VERSION = '1.3.4' | ||
VERSION = '1.3.5' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/support/helpers/client_helper_spec.rb → ...k/rspec_helper/client/smtp_client_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../helpers/context_generator_helper_spec.rb → ...ck/rspec_helper/context_generator_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...support/helpers/dependency_helper_spec.rb → ...smtp_mock/rspec_helper/dependency_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/support/helpers/server_helper_spec.rb → spec/smtp_mock/rspec_helper/server_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: true | ||
|
||
module SmtpMock | ||
module RspecHelper | ||
module Client | ||
class SmtpClient | ||
require 'net/smtp' | ||
|
||
UNDEFINED_VERSION = '0.0.0' | ||
|
||
Error = ::Class.new(::StandardError) | ||
|
||
def initialize(host, port, net_class = ::Net::SMTP) | ||
@net_class = net_class | ||
@net_smtp_version = resolve_net_smtp_version | ||
@net_smtp = old_net_smtp? ? net_class.new(host, port) : net_class.new(host, port, tls_verify: false) | ||
end | ||
|
||
def start(helo_domain, &block) | ||
return net_smtp.start(helo_domain, &block) if net_smtp_version < '0.2.0' | ||
return net_smtp.start(helo_domain, tls_verify: false, &block) if old_net_smtp? | ||
net_smtp.start(helo: helo_domain, &block) | ||
end | ||
|
||
private | ||
|
||
attr_reader :net_class, :net_smtp_version, :net_smtp | ||
|
||
def resolve_net_smtp_version | ||
return net_class::VERSION if net_class.const_defined?(:VERSION) | ||
SmtpMock::RspecHelper::Client::SmtpClient::UNDEFINED_VERSION | ||
end | ||
|
||
def old_net_smtp? | ||
net_smtp_version < '0.3.0' | ||
end | ||
end | ||
|
||
def smtp_request(host:, port:, mailfrom:, rcptto:, message:, helo_domain: nil) # rubocop:disable Metrics/ParameterLists | ||
SmtpMock::RspecHelper::Client::SmtpClient.new(host, port).start(helo_domain) do |session| | ||
session.send_message(message, mailfrom, rcptto) | ||
rescue ::Net::SMTPFatalError => error | ||
raise SmtpMock::RspecHelper::Client::SmtpClient::Error, error.message.strip | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.