Skip to content

Commit

Permalink
Using HOST and PORT (#585)
Browse files Browse the repository at this point in the history
* Using HOST and PORT variables
  • Loading branch information
Vladimir Bazhanov authored Jun 17, 2020
1 parent 582904b commit 6828de0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Port to serve application
PORT=5000

# Host name with PORT of the application
HOST=lvh.me:5000
# Host name of the application
HOST=lvh.me

# Current environment
RACK_ENV=development
Expand Down
5 changes: 4 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class Application < Rails::Application
config.action_mailer.default_options = { from: ENV.fetch("MAILER_SENDER_ADDRESS") }

# Set URL options to be able to use url_for helpers
config.action_mailer.default_url_options = { host: ENV.fetch("HOST") }
config.action_mailer.default_url_options = { host: ENV.fetch("HOST"), port: ENV.fetch("PORT") }

# Add HOST to allowed list
config.hosts << ENV.fetch("HOST")
end
end
6 changes: 2 additions & 4 deletions spec/features/user/account/cancel_spec.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
require "rails_helper"

feature "Cancel Account", js: true do
feature "Cancel Account" do
include_context "when current user signed in"

background do
visit edit_user_registration_path(current_user)
end

scenario "User cancels account" do
accept_alert do
click_link "Cancel my account"
end
click_link "Cancel my account"

expect(page).to have_content("Sign in")
expect(page).to have_content("Bye! Your account has been successfully cancelled. We hope to see you again soon.")
Expand Down
3 changes: 2 additions & 1 deletion spec/support/capybara.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Capybara.configure do |config|
config.match = :prefer_exact
config.asset_host = "http://#{ENV.fetch('HOST')}"
config.app_host = "http://#{ENV.fetch('HOST')}:#{ENV.fetch('PORT')}"
config.asset_host = "http://#{ENV.fetch('HOST')}:#{ENV.fetch('PORT')}"
end

Capybara.javascript_driver = :selenium_chrome_headless

0 comments on commit 6828de0

Please sign in to comment.