Home > Software engineering >  Is it possible to change Rails ENV in ActionDispatch::IntegrationTest?
Is it possible to change Rails ENV in ActionDispatch::IntegrationTest?

Time:04-24

ENV variable values are set in config/application.yml in a rails app. is it possible to change only for specific test case in ActionDispatch::IntegrationTest? Something like this:

class DummyTest < ActionDispatch::IntegrationTest
  context '...' do
    it '...' do
      ENV['API_URL'] = ...
    end
  end
end

I have tried this but it doesn't seem to change anything. Thanks

CodePudding user response:

I think you've missed creating-rails-environments of the configuration on the Rails documentation.

  • Related