Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to start application if ORI setup is incomplete #35

Merged
merged 2 commits into from
Nov 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions config/initializers/custom/ori.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# App should fail to start if ORI data isn't loaded.

unless Rails.env.test?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we need this for testing? Wouldn't all the specs fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We mock these constants in tests. It's necessary so that the test results are consistent regardless of what ORIs are actually loaded.

if !defined?(Constants::CONTRACTING_ORIS)
raise "Constants::CONTRACTING_ORIS not specified! Have you run `docker-compose run data`?"
elsif !defined?(Constants::DEPARTMENT_BY_ORI)
raise "Constants::DEPARTMENT_BY_ORI not specified! Have you run `docker-compose run data`?"
end
end