diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3742c6..36f13f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -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: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 68d6405..7b29724 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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: diff --git a/mailosaur.gemspec b/mailosaur.gemspec index 6101e6b..d017a59 100644 --- a/mailosaur.gemspec +++ b/mailosaur.gemspec @@ -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' diff --git a/test/mailer.rb b/test/mailer.rb index 704e762..ce8de92 100644 --- a/test/mailer.rb +++ b/test/mailer.rb @@ -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