-
Hey there - just started using Flipper, so apologies if this has been asked elsewhere. I want Flipper to pretty much 'get out of the way' when I'm running my test suite. Using Rspec I started by doing this: config.before(:each) do
allow(Flipper).to_receive(:enabled?).and_return(true)
end and this worked, but I noticed that there's an HTTP call also being made, so I had to: WebMock.stub_request(:get, "https://www.flippercloud.io/adapter/features").to_return(status: 200, body: "") Is there a better pattern for this? I feel like I must be missing something obvious... |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @eyefodder, you'll need to override the default flipper instance. config.before(:each) do
Flipper.instance = Flipper.new(Flipper::Adapters::Memory.new)
allow(Flipper).to_receive(:enabled?).and_return(true)
end I'll work on an update to docs (or Flipper's behavior in tests) to make this more clear. |
Beta Was this translation helpful? Give feedback.
-
This should/could/would only happen if you are using cloud. Are you? Either way, if you switch to memory adapter for tests then you won't need the web mock anymore. |
Beta Was this translation helpful? Give feedback.
Hi @eyefodder, you'll need to override the default flipper instance.
I'll work on an update to docs (or Flipper's behavior in tests) to make this more clear.