Skip to content

Commit

Permalink
Keep rubocop happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Oct 4, 2024
1 parent dba149b commit 0f22222
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/support/split_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SplitHelper
# Force a specific experiment alternative to always be returned:
# use_ab_test(signup_form: "single_page")
Expand All @@ -6,11 +8,13 @@ module SplitHelper
# use_ab_test(signup_form: "single_page", pricing: "show_enterprise_prices")
#
def use_ab_test(alternatives_by_experiment)
# rubocop:disable RSpec/AnyInstance
allow_any_instance_of(Split::Helper).to receive(:ab_test) do |_receiver, experiment, &block|
variant = alternatives_by_experiment.fetch(experiment) { |key| raise "Unknown experiment '#{key}'" }
block.call(variant) unless block.nil?
block&.call(variant)
variant
end
# rubocop:enable RSpec/AnyInstance
end
end

Expand Down

0 comments on commit 0f22222

Please sign in to comment.