TL;DR: My Figaro variables are not set when I run zeus rspec spec/
.
The title pretty much explains the problem briefly, but I'll elaborate.
In a Rails 4 application, I'm using Figaro to store environment specific configuration, e.g. the Rails secret token (Rails.configuration.secret_key_base
). This works fine in itself. I am also using Zeus to preload my Rails configuration, which also works like a charm.
However, when combined and running my RSpec specs (through zeus rspec spec/
) my Rails secret token is removed. This, of course, outputs a deprecation warning and then errors out:
DEPRECATION WARNING: You didn't set config.secret_key_base.
[...]
RuntimeError:
You must set config.secret_key_base in your app's config.
While the specs are running, I notice that the Rails environment has changed (Rails.env == "test"
), and I presume this might be done by Zeus automagically, as it happens even if I remove my changing the environment from my spec_helper.rb file.
It might also be worth mentioning that my specs run completely fine without Zeus.
I found that if I explicitly set the secret token to a value in spec_helper.rb, then stuff works fine from within Zeus, but my Figaro environment variables are not present.
Basically, it seems as if my environment variables from Figaro are not being set when Zeus runs the specs. If anyone knows how I could make Zeus set these upon running my tests, that would be super awesome!
Much appreciated, people. :-)
I just switched to using the dotenv
gem:
https://github.com/bkeepers/dotenv
Add the following line to your Gemfile:
gem 'dotenv', groups: [:development, :test]
bundle install
, and restart Zeus - you should be good to go!