if Rails.env.test?
  $redis = Redis.new
else
  uri = URI.parse(ENV['REDISTOGO_URL'])
  $redis = Redis.new(host: uri.host, port: uri.port, password: uri.password)
end

if Rails.env.test?
  $redis = Redis.new
else
  return unless ENV['REDISTOGO_URL']

  uri = URI.parse(ENV['REDISTOGO_URL'])
  $redis = Redis.new(host: uri.host, port: uri.port, password: uri.password)
end

Add check for env variable.
Add check for env variable.

Because:

The deploy to Heroku button is launching builds that break due to a
missing env variable.

This:

Adds a guard clause to short circuit before redis attempts to use the
env variable.
