Replies: 2 comments 2 replies
-
This is what we're using now, based on the closed issue, and it seems to work but there are concerns about thread safety. In the flipper.rb initializer: if Rails.env.test?
shared_test_adapter = Flipper::Adapters::Memory.new
Flipper.configure do |config|
config.adapter do
shared_test_adapter
end
end
end In our test helper: def after_teardown
super
Flipper.instance.adapter.get_all.clear
end |
Beta Was this translation helpful? Give feedback.
-
@jhubert if you are using a separate process and need to share state across the processes, you can use the pstore adapter (assuming they are on the same machine, here is an example of test setup). You can also use the active record adapter for system tests. The primary reason we recommend the memory adapter for tests is speed and cleanliness of state between tests, but the active record adapter should retain this as well assuming you are using a transaction around or database cleaner around each test. Does any of that help or can we drop more specifics? Just let us know. |
Beta Was this translation helpful? Give feedback.
-
Is there a best practice for using Flipper in system tests? Our system tests run in a different process, so the memory adapter from the documentation doesn't work. The test
Flipper.instance
is different from the appFlipper.instance
that's being tested. I don't think we're doing anything that crazy... just using cuprite as a driver on top of headless chrome.Is there a best practice we should be following for this? Or a way that other people have done it? I read through the closed issue on this topic but there doesn't seem to be any resolution.
Beta Was this translation helpful? Give feedback.
All reactions