Skip to content

Commit

Permalink
Optional CF_* env variables for unit tests
Browse files Browse the repository at this point in the history
It's a pain to have to set all the environment config to junk values
when you only want to run unit tests.

This sets all the required vars to "none" unless the CONTRACT_TEST_TOKEN
is set (which is what triggers integration test execution)
  • Loading branch information
chrisfarms committed Dec 12, 2017
1 parent 47ddeb1 commit f1608d8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

# In test mode we only need the CF_ vars if running integration tests
if ENV["CONTRACT_TEST_TOKEN"].blank?
ENV["CF_API_ENDPOINT"] = "none"
ENV["CF_TOKEN_ENDPOINT"] = "none"
ENV["CF_AUTH_ENDPOINT"] = "none"
ENV["CF_CLIENT_ID"] = "none"
ENV["CF_CLIENT_SECRET"] = "none"
end

OmniAuth.config.test_mode = true

# Allow hijacking sessions in tests
Expand Down

0 comments on commit f1608d8

Please sign in to comment.