Skip to content

Instantly share code, notes, and snippets.

View jfederico's full-sized avatar

Jesus Federico jfederico

View GitHub Profile
@jazzytomato
jazzytomato / mock_env.rb
Last active April 3, 2024 00:49
Simple method to mock environment variable in ruby with minitest or other testing framework
# in test_helper.rb (for example)
def mock_env(partial_env_hash)
old = ENV.to_hash
ENV.update partial_env_hash
begin
yield
ensure
ENV.replace old
end
end
# proxying through apache to a local rails instance, http & https
# apache *.conf file
<VirtualHost *:80>
ServerName psl.localhost
ServerAlias cms.psl.localhost
ServerAlias *.psl.localhost
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/