Skip to content

Commit

Permalink
[NU-19] Add flag to remove synaccess rev a relay option (#5060)
Browse files Browse the repository at this point in the history
* Add flag to remove synaccess rev a relay option
  • Loading branch information
joaquinco authored Feb 28, 2025
1 parent 8fc701a commit 0024a86
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/helpers/products_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ def options_for_control_mechanism
end

def options_for_relay
{
RelaySynaccessRevA => RelaySynaccessRevA.name,
RelaySynaccessRevB => RelaySynaccessRevB.name,
RelayDataprobe => RelayDataprobe.name,
}
[
if SettingsHelper.feature_on?(:disable_relay_synaccess_rev_a)
nil
else
[RelaySynaccessRevA, RelaySynaccessRevA.name]
end,
[RelaySynaccessRevB, RelaySynaccessRevB.name],
[RelayDataprobe, RelayDataprobe.name],
].compact
end

def instrument_pricing_modes
Expand Down
1 change: 1 addition & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ feature:
show_daily_rate_option: true
sanger_enabled_service: <%= ENV.fetch("SANGER_ENABLED_SERVICE", false) %>
well_plate_alternative_csv_format: <%= ENV.fetch("well_plate_alternative_csv_format", false) %>
disable_relay_synaccess_rev_a: false

split_accounts:
# Roles are allowed to create Split Accounts
Expand Down
27 changes: 27 additions & 0 deletions spec/helpers/products_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require "rails_helper"

RSpec.describe ProductsHelper do
describe "#options_for_relay" do
let(:subject) { options_for_relay }

it(
"list all relay types if none disabled",
{ feature_setting: { disable_relay_synaccess_rev_a: false } }
) do
expect(subject.to_h).to include(
RelaySynaccessRevA,
RelaySynaccessRevB,
RelayDataprobe
)
end

it(
"exclude synaccess rev a if disabled flag is on",
{ feature_setting: { disable_relay_synaccess_rev_a: true } }
) do
expect(subject.to_h).to_not include(RelaySynaccessRevA)
end
end
end

0 comments on commit 0024a86

Please sign in to comment.