Figaro not using correct environment variable when testing

82 Views Asked by At

For some reason Figaro is not setting my DATABASE_URL properly when testing. It uses the development DATABASE_URL for some reason. Here's the final few rows of my application.yml:

development:
  DATABASE_URL:               'postgres:///xxx-development'

test:
  DATABASE_URL:               'postgres:///xxx_test'

In my test I added a few print lines to help debug:

require 'rails_helper'
require 'json'
require 'rake'

RSpec.describe 'HealthProfile::HealthProfileTypeformParser' do
    
    before(:all) do
        p "ENV", ENV['RAILS_ENV'], ENV['DATABASE_URL']
        # prints "ENV", "test", "postgres:///xxx-development"
    end
 end

It makes no sense as clearly the environement is being set. Is there something else I need to do?

0

There are 0 best solutions below