Skip to content

Commit

Permalink
Fix mail dev dependency version
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-mailosaur committed Dec 5, 2022
1 parent f788652 commit 5a77d45
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ concurrency:

jobs:
build:
runs-on: ubuntu-20.04 # 22.04 (latest) has build issues
runs-on: ubuntu-latest
timeout-minutes: 10

env:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
build-next:
if: ${{ always() }}
needs: build
runs-on: ubuntu-20.04 # 22.04 (latest) has build issues
runs-on: ubuntu-latest
timeout-minutes: 10

env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
publish:
runs-on: ubuntu-20.04 # 22.04 (latest) has build issues
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
Expand Down
2 changes: 1 addition & 1 deletion mailosaur.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency 'faraday', '>= 2.0', '< 3'
s.add_dependency 'json', '>= 1.7.5', '< 4'

s.add_development_dependency 'mail', '~> 2.7', '>= 2.7.1'
s.add_development_dependency 'mail', '~> 2.8'
s.add_development_dependency 'rake', '~> 13.0'
s.add_development_dependency 'rubocop', '~> 1.30.0'
s.add_development_dependency 'shoulda-context', '~> 2.0', '>= 2.0.0'
Expand Down
63 changes: 31 additions & 32 deletions test/mailer.rb
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
require 'mail'

Mail.defaults do
delivery_method :smtp, {
address: ENV['MAILOSAUR_SMTP_HOST'] || 'mailosaur.net',
port: ENV['MAILOSAUR_SMTP_PORT'] || 25,
enable_starttls_auto: false
}
delivery_method :smtp, {
address: ENV['MAILOSAUR_SMTP_HOST'] || 'mailosaur.net',
port: ENV['MAILOSAUR_SMTP_PORT'] || 25
}
end

class Mailer
@@html = File.open('test/resources/testEmail.html').read
@@text = File.open('test/resources/testEmail.txt').read
@@verified_domain = ENV['MAILOSAUR_VERIFIED_DOMAIN'] || 'mailosaur.net'

def self.send_emails(client, server, quantity)
(1..quantity).each do |_i|
send_email(client, server)
end
@@html = File.open('test/resources/testEmail.html').read
@@text = File.open('test/resources/testEmail.txt').read
@@verified_domain = ENV['MAILOSAUR_VERIFIED_DOMAIN'] || 'mailosaur.net'

def self.send_emails(client, server, quantity)
(1..quantity).each do |_i|
send_email(client, server)
end
end

def self.send_email(client, server, send_to_address = nil)
Mail.deliver do
random_string = (0...10).map { rand(65..90).chr }.join
def self.send_email(client, server, send_to_address = nil)
Mail.deliver do
random_string = (0...10).map { rand(65..90).chr }.join

subject '%s subject' % [random_string]
random_to_address = send_to_address || client.servers.generate_email_address(server)
subject format('%s subject', random_string)
random_to_address = send_to_address || client.servers.generate_email_address(server)

from '%s %s <%s@%s>' % [random_string, random_string, random_string, @@verified_domain]
to '%s %s <%s>' % [random_string, random_string, random_to_address]
from format('%s %s <%s@%s>', random_string, random_string, random_string, @@verified_domain)
to format('%s %s <%s>', random_string, random_string, random_to_address)

text_part do
body @@text.to_s.gsub('REPLACED_DURING_TEST', random_string)
end
text_part do
body @@text.to_s.gsub('REPLACED_DURING_TEST', random_string)
end

html_part do
content_type 'text/html; charset=UTF-8'
body @@html.to_s.gsub('REPLACED_DURING_TEST', random_string)
end
html_part do
content_type 'text/html; charset=UTF-8'
body @@html.to_s.gsub('REPLACED_DURING_TEST', random_string)
end

add_file 'test/resources/cat.png'
add_file 'test/resources/dog.png'
add_file 'test/resources/cat.png'
add_file 'test/resources/dog.png'

inline = attachments['cat.png']
inline.content_id = 'ii_1435fadb31d523f6'
end
inline = attachments['cat.png']
inline.content_id = 'ii_1435fadb31d523f6'
end
end
end

0 comments on commit 5a77d45

Please sign in to comment.