Skip to content

Commit

Permalink
Merge pull request #3792 from juankuquintana/add-port-mailer-links
Browse files Browse the repository at this point in the history
Add development environment a default mailer port configuration
  • Loading branch information
jenshenny committed Jun 2, 2023
2 parents dad8ff4 + 45c2494 commit 64595b6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Metrics/BlockLength:
- lib/github_oauthable.rb
- app/models/concerns/**/*.rb
- config/routes.rb
- config/environments/development.rb

Metrics/ClassLength:
Max: 356 # TODO: Lower to 100
Expand Down
1 change: 1 addition & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
config.action_mailer.perform_caching = false

config.action_mailer.default_url_options = { host: Gemcutter::HOST,
port: ENV.fetch("PORT", "3000"),
protocol: Gemcutter::PROTOCOL }

# Print deprecation notices to the Rails logger.
Expand Down
1 change: 1 addition & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { host: Gemcutter::HOST,
port: "31337",
protocol: Gemcutter::PROTOCOL }

# Print deprecation notices to the stderr.
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/email_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def mails_count
def confirmation_link
refute_empty ActionMailer::Base.deliveries
body = last_email.parts[1].body.decoded.to_s
link = %r{http://localhost/email_confirmations([^";]*)}.match(body)
link = %r{http://localhost(?::\d+)?/email_confirmations([^";]*)}.match(body)
link[0]
end
end
2 changes: 1 addition & 1 deletion test/integration/password_reset_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class PasswordResetTest < SystemTest

def password_reset_link
body = ActionMailer::Base.deliveries.last.parts[1].body.decoded.to_s
link = %r{http://localhost/users([^";]*)}.match(body)
link = %r{http://localhost(?::\d+)?/users([^";]*)}.match(body)
link[0]
end

Expand Down
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
Capybara.default_max_wait_time = 2
Capybara.app_host = "#{Gemcutter::PROTOCOL}://#{Gemcutter::HOST}"
Capybara.always_include_port = true
Capybara.server_port = 31_337
Capybara.server = :puma

GoodJob::Execution.delete_all
Expand Down

0 comments on commit 64595b6

Please sign in to comment.