combined consumer and proxy into minimal rails backed

This commit is contained in:
Mike Sutton
2022-11-16 01:01:10 +01:00
parent d3be685b08
commit 329e66c949
16 changed files with 33 additions and 346 deletions

1
tests/.ruby-gemset Normal file
View File

@ -0,0 +1 @@
bettermail_tests

1
tests/.ruby-version Normal file
View File

@ -0,0 +1 @@
ruby-2.7.2

5
tests/Gemfile Normal file
View File

@ -0,0 +1,5 @@
source 'https://rubygems.org'
ruby '2.7.2'
gem 'bunny'
gem 'mail'

28
tests/Gemfile.lock Normal file
View 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

View 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