Here's an example of what I'm thinking:
# config/initializers/binflip.rb
$toggle = Binflip.new
$toggle.always_enable_if -> { Rails.env.test? }
#$toggle.always_enable_if -> { ENV['RACK_ENV'] == 'test' }
Basically, this would be a way of ensuring that all features are always active in test mode, to prevent having to worry about toggling in tests.
If we want to test that/how a feature is toggled off, could add an additional:
describe "my feature" do
it "can be toggled off" do
$toggle.ensure_disabled(:my_feature) do
# visit the page and assert it's gone
end
end
end
Which would provide a block inside of which $toggle.active?(:my_feature) returns false.