Skip to content

Instantly share code, notes, and snippets.

@darkbushido
Last active March 10, 2020 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkbushido/19e9b770ba42d43105682bbd30b266bd to your computer and use it in GitHub Desktop.
Save darkbushido/19e9b770ba42d43105682bbd30b266bd to your computer and use it in GitHub Desktop.
def base_method_name(params)
if Flipper.enabled?(:feature_flag)
base_method_name_feature_enabled(params)
else
base_method_name_feature_disabled(params)
end
end
def base_method_name_feature_enabled(params)
# How it behaves with the feature flag enabled
end
def base_method_name_feature_disabled(params)
# How it behaves without the feature flag enabled
end
### spec
RSpec.describe Object do
[true, false].each do |flipper_bool|
context "Feature feature_flag=#{flipper_bool}" do
before do
if flipper_bool
Flipper.enable(:feature_flag)
else
Flipper.disable(:feature_flag)
end
end
it "behaves the same" do
end
end
context "Feature feature_flag=true" do
before do
Flipper.enable(:feature_flag)
end
it "behaves this way with the feature enabled" do
end
end
context "Feature feature_flag=false" do
before do
Flipper.disable(:feature_flag)
end
it "behaves this way with the feature disabled" do
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment