combined consumer and proxy into minimal rails backed
This commit is contained in:
1
tests/.ruby-gemset
Normal file
1
tests/.ruby-gemset
Normal file
@ -0,0 +1 @@
|
||||
bettermail_tests
|
1
tests/.ruby-version
Normal file
1
tests/.ruby-version
Normal file
@ -0,0 +1 @@
|
||||
ruby-2.7.2
|
5
tests/Gemfile
Normal file
5
tests/Gemfile
Normal file
@ -0,0 +1,5 @@
|
||||
source 'https://rubygems.org'
|
||||
ruby '2.7.2'
|
||||
gem 'bunny'
|
||||
gem 'mail'
|
||||
|
28
tests/Gemfile.lock
Normal file
28
tests/Gemfile.lock
Normal file
@ -0,0 +1,28 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
amq-protocol (2.3.2)
|
||||
bunny (2.19.0)
|
||||
amq-protocol (~> 2.3, >= 2.3.1)
|
||||
sorted_set (~> 1, >= 1.0.2)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
mini_mime (1.1.2)
|
||||
rbtree (0.4.5)
|
||||
set (1.0.3)
|
||||
sorted_set (1.0.3)
|
||||
rbtree
|
||||
set (~> 1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
bunny
|
||||
mail
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.7.2p137
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
31
tests/test_sending_emails.rb
Normal file
31
tests/test_sending_emails.rb
Normal file
@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'mail'
|
||||
require 'bunny'
|
||||
require 'securerandom'
|
||||
|
||||
@default_smtp_settings = {
|
||||
address: 'localhost',
|
||||
port: '2025',
|
||||
user_name: 'hello',
|
||||
password: 'world',
|
||||
enable_starttls_auto: true,
|
||||
authentication: 'plain',
|
||||
openssl_verify_mode: 'none'
|
||||
}
|
||||
|
||||
def send_mail(index)
|
||||
mail = Mail.new(
|
||||
from: "test-#{index}-#{SecureRandom.uuid}@thefactory.local",
|
||||
to: "#{SecureRandom.uuid}@acme.local",
|
||||
cc: "cc-#{SecureRandom.uuid}@acme.local",
|
||||
bcc: "bcc-#{SecureRandom.uuid}@acme.local",
|
||||
subject: "Testing #{index}",
|
||||
)
|
||||
mail.delivery_method :smtp, @default_smtp_settings
|
||||
mail.deliver!
|
||||
end
|
||||
|
||||
number_of_emails = ARGV[0] || 1
|
||||
|
||||
send_mail number_of_emails
|
Reference in New Issue
Block a user