مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
style(rubocop): Style/StringLiterals
هذا الالتزام موجود في:
6
Gemfile
6
Gemfile
@@ -17,7 +17,7 @@ gem "gelf"
|
|||||||
gem "haml"
|
gem "haml"
|
||||||
gem "hashie"
|
gem "hashie"
|
||||||
gem "highline", require: false
|
gem "highline", require: false
|
||||||
gem "execjs", '~> 2.7', "< 2.8"
|
gem "execjs", "~> 2.7", "< 2.8"
|
||||||
gem "jwt"
|
gem "jwt"
|
||||||
gem "kaminari"
|
gem "kaminari"
|
||||||
gem "mail"
|
gem "mail"
|
||||||
@@ -30,8 +30,8 @@ gem "puma"
|
|||||||
gem "rails", "= 6.1.7.6"
|
gem "rails", "= 6.1.7.6"
|
||||||
gem "resolv", "~> 0.2.1"
|
gem "resolv", "~> 0.2.1"
|
||||||
gem "secure_headers"
|
gem "secure_headers"
|
||||||
gem 'sentry-rails'
|
gem "sentry-rails"
|
||||||
gem 'sentry-ruby'
|
gem "sentry-ruby"
|
||||||
gem "turbolinks", "~> 5"
|
gem "turbolinks", "~> 5"
|
||||||
|
|
||||||
group :development, :assets do
|
group :development, :assets do
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
Rails.autoloaders.each do |autoloader|
|
Rails.autoloaders.each do |autoloader|
|
||||||
# Ignore the message DB migrations directory as it doesn't follow
|
# Ignore the message DB migrations directory as it doesn't follow
|
||||||
# Zeitwerk's conventions and is always loaded and executed in order.
|
# Zeitwerk's conventions and is always loaded and executed in order.
|
||||||
autoloader.ignore(Rails.root.join('lib/postal/message_db/migrations'))
|
autoloader.ignore(Rails.root.join("lib/postal/message_db/migrations"))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
# This script will automatically send an HTML email to the
|
# This script will automatically send an HTML email to the
|
||||||
# SMTP server given.
|
# SMTP server given.
|
||||||
|
|
||||||
require 'mail'
|
require "mail"
|
||||||
require 'net/smtp'
|
require "net/smtp"
|
||||||
|
|
||||||
from = ARGV[0]
|
from = ARGV[0]
|
||||||
to = ARGV[1]
|
to = ARGV[1]
|
||||||
@@ -19,7 +19,7 @@ mail = Mail.new
|
|||||||
mail.to = to
|
mail.to = to
|
||||||
mail.from = from
|
mail.from = from
|
||||||
mail.subject = "A test email from #{Time.now.to_s}"
|
mail.subject = "A test email from #{Time.now.to_s}"
|
||||||
mail['X-Postal-Tag'] = 'send-html-email-script'
|
mail["X-Postal-Tag"] = "send-html-email-script"
|
||||||
mail.text_part = Mail::Part.new do
|
mail.text_part = Mail::Part.new do
|
||||||
body <<~BODY
|
body <<~BODY
|
||||||
Hello there.
|
Hello there.
|
||||||
@@ -32,7 +32,7 @@ mail.text_part = Mail::Part.new do
|
|||||||
BODY
|
BODY
|
||||||
end
|
end
|
||||||
mail.html_part = Mail::Part.new do
|
mail.html_part = Mail::Part.new do
|
||||||
content_type 'text/html; charset=UTF-8'
|
content_type "text/html; charset=UTF-8"
|
||||||
body <<~BODY
|
body <<~BODY
|
||||||
<p>Hello there</p>
|
<p>Hello there</p>
|
||||||
<p>This is an example email. It doesn't do all that much.</p>
|
<p>This is an example email. It doesn't do all that much.</p>
|
||||||
@@ -43,7 +43,7 @@ end
|
|||||||
|
|
||||||
#puts mail.to_s
|
#puts mail.to_s
|
||||||
|
|
||||||
Net::SMTP.start('127.0.0.1', 2525) do |smtp|
|
Net::SMTP.start("127.0.0.1", 2525) do |smtp|
|
||||||
smtp.send_message mail.to_s, mail.from.first, mail.to.first
|
smtp.send_message mail.to_s, mail.from.first, mail.to.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ describe Postal::MessageDB::ConnectionPool do
|
|||||||
|
|
||||||
subject(:pool) { described_class.new }
|
subject(:pool) { described_class.new }
|
||||||
|
|
||||||
describe '#use' do
|
describe "#use" do
|
||||||
it 'yields a connection' do
|
it "yields a connection" do
|
||||||
counter = 0
|
counter = 0
|
||||||
pool.use do |connection|
|
pool.use do |connection|
|
||||||
expect(connection).to be_a Mysql2::Client
|
expect(connection).to be_a Mysql2::Client
|
||||||
@@ -16,7 +16,7 @@ describe Postal::MessageDB::ConnectionPool do
|
|||||||
expect(counter).to eq 1
|
expect(counter).to eq 1
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'checks in a connection after the block has executed' do
|
it "checks in a connection after the block has executed" do
|
||||||
connection = nil
|
connection = nil
|
||||||
pool.use do |c|
|
pool.use do |c|
|
||||||
expect(pool.connections).to be_empty
|
expect(pool.connections).to be_empty
|
||||||
@@ -25,7 +25,7 @@ describe Postal::MessageDB::ConnectionPool do
|
|||||||
expect(pool.connections).to eq [connection]
|
expect(pool.connections).to eq [connection]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'checks in a connection if theres an error in the block' do
|
it "checks in a connection if theres an error in the block" do
|
||||||
expect do
|
expect do
|
||||||
pool.use do |c|
|
pool.use do |c|
|
||||||
raise StandardError
|
raise StandardError
|
||||||
@@ -34,7 +34,7 @@ describe Postal::MessageDB::ConnectionPool do
|
|||||||
expect(pool.connections).to match [kind_of(Mysql2::Client)]
|
expect(pool.connections).to match [kind_of(Mysql2::Client)]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not check in connections when there is a connection error' do
|
it "does not check in connections when there is a connection error" do
|
||||||
expect do
|
expect do
|
||||||
pool.use do
|
pool.use do
|
||||||
raise Mysql2::Error, "lost connection to server"
|
raise Mysql2::Error, "lost connection to server"
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم