Sha256: 3a561602723cdc4c35fb7ae0c8898dc53de3fdc8668fca4196683dce0eaf4df5

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

require_relative '../utils/restricted_hash'

module FeatureFlagMonitor
  module Test
    module Helpers
    end
  end
end

module FeatureFlagMonitor::Test::Helpers
  class << self
    attr_accessor :defaults, :wrapper_class
  end
  @defaults = {}

  def stub_feature_flags(flags = {})
    flags = FeatureFlagMonitor::Utils.wrapper_class.new(FeatureFlagMonitor::Test::Helpers.defaults.merge(flags))

    allow(FeatureFlagMonitor).to receive(:list).
      and_return(flags.transform_values { { description: '' } })
    allow(FeatureFlagMonitor).to receive(:type_data).
      and_return(flags.transform_values { %w(boolean integer string) }) # don't try to be smart; presume all types are acceptable
    allow(FeatureFlagMonitor).to receive(:flag) { |name:, on_domain:| flags[name] }
    allow(FeatureFlagMonitor).to receive(:flags_on).and_return(flags)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feature-flag-monitor-0.5.4 lib/feature_flag_monitor/test/helpers.rb