Merge pull request #12111 from openfoodfoundation/dependabot/bundler/flipper-and-flipper-active_record-and-flipper-ui-1.2.2

chore(deps): bump flipper, flipper-active_record and flipper-ui
This commit is contained in:
Gaetan Craig-Riou
2024-05-06 10:45:39 +10:00
committed by GitHub
5 changed files with 43 additions and 10 deletions

View File

@@ -286,15 +286,15 @@ GEM
websocket-driver (>= 0.6, < 0.8)
ffaker (2.23.0)
ffi (1.16.3)
flipper (0.26.2)
flipper (1.2.2)
concurrent-ruby (< 2)
flipper-active_record (0.26.2)
flipper-active_record (1.2.2)
activerecord (>= 4.2, < 8)
flipper (~> 0.26.2)
flipper-ui (0.26.2)
flipper (~> 1.2.2)
flipper-ui (1.2.2)
erubi (>= 1.0.0, < 2.0.0)
flipper (~> 0.26.2)
rack (>= 1.4, < 3)
flipper (~> 1.2.2)
rack (>= 1.4, < 4)
rack-protection (>= 1.5.3, <= 4.0.0)
sanitize (< 7)
fog-aws (2.0.1)
@@ -686,7 +686,7 @@ GEM
rubyzip (2.3.2)
rufus-scheduler (3.8.2)
fugit (~> 1.1, >= 1.1.6)
sanitize (6.0.2)
sanitize (6.1.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
sass (3.4.25)

View File

@@ -2,8 +2,23 @@ require "flipper"
require "flipper/adapters/active_record"
require "open_food_network/feature_toggle"
Flipper.register(:admins) { |actor| actor.respond_to?(:admin?) && actor.admin? }
Rails.application.configure do
# Disable Flipper's built-in test helper.
# It fails in CI and feature don't get activated.
config.flipper.test_help = false
end
Flipper.configure do |flipper|
# Still use recommended test setup with faster memory adapter:
if Rails.env.test?
# Use a shared Memory adapter for all tests. The adapter is instantiated
# outside of the block so the same instance is returned in new threads.
adapter = Flipper::Adapters::Memory.new
flipper.adapter { adapter }
end
end
Flipper.register(:admins) { |actor| actor.respond_to?(:admin?) && actor.admin? }
Flipper::UI.configure do |config|
config.descriptions_source = ->(_keys) do
# return has to be hash of {String key => String description}

View File

@@ -0,0 +1,18 @@
# frozen_string_literal: true
class ChangeFlipperGatesValueToText < ActiveRecord::Migration[7.0]
def up
# Ensure this incremental update migration is idempotent
return unless connection.column_exists? :flipper_gates, :value, :string
if index_exists? :flipper_gates, [:feature_key, :key, :value]
remove_index :flipper_gates, [:feature_key, :key, :value]
end
change_column :flipper_gates, :value, :text
add_index :flipper_gates, [:feature_key, :key, :value], unique: true, length: { value: 255 }
end
def down
change_column :flipper_gates, :value, :string
end
end

View File

@@ -282,7 +282,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_30_075133) do
create_table "flipper_gates", id: :serial, force: :cascade do |t|
t.string "feature_key", null: false
t.string "key", null: false
t.string "value"
t.text "value"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["feature_key", "key", "value"], name: "index_flipper_gates_on_feature_key_and_key_and_value", unique: true

View File

@@ -102,7 +102,7 @@ RSpec.configure do |config|
end
# Reset all feature toggles to prevent leaking.
config.before(:suite) do
config.before(:each) do
Flipper.features.each(&:remove)
OpenFoodNetwork::FeatureToggle.setup!
end