Since 1.2.0, Flipper will default to the
Memory adapter when running tests in a Rails app and reset it before each test. This means each test is run with a fresh instance of Flipper and all features disabled. We find this the best route, but your application may have different needs. If you want some features to always be enabled, you can enable them in your test setup.
In the example above, the
plausible features would both start enabled for every test. Every other feature flag would start disabled.
Test Both Sides
For any feature flag, we strongly encourage you to have at least one test for when the feature is enabled and disabled. This ensures both sides of the coin are tested.
class DocumentationControllerTest < ActionDispatch::IntegrationTest
test "returns 404 for documentation when feature disabled" do
test "renders documentation when feature enabled" do
For non-Rails apps or Flipper <1.2, see test_help.rb.