Skip to content

Commit

Permalink
Adjust feature flag to allow specs to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahwcodes committed Oct 24, 2024
1 parent bbf58cb commit 8b1d246
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
end

describe '#perform' do
before do
allow(Flipper).to receive(:enabled?).with(:notification_creation).and_return(false)
end

it 'logs message to sentry and raises if no submission exists' do
with_settings(Settings.sentry, dsn: 'T') do
expect(VaNotify::Service).not_to receive(:new)
Expand Down
24 changes: 18 additions & 6 deletions modules/va_notify/lib/va_notify/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,31 @@ def initialize(api_key)
end

def send_email(args)
response = with_monitoring do
notify_client.send_email(args)
if Flipper.enabled?(:notification_creation)
response = with_monitoring do
notify_client.send_email(args)
end
create_notification(response)
else
with_monitoring do
notify_client.send_email(args)
end
end
create_notification(response) if Flipper.enabled?(:notification_creation)
rescue => e
handle_error(e)
end

def send_sms(args)
response = with_monitoring do
notify_client.send_sms(args)
if Flipper.enabled?(:notification_creation)
response = with_monitoring do
notify_client.send_sms(args)
end
create_notification(response)
else
with_monitoring do
notify_client.send_sms(args)
end
end
create_notification(response) if Flipper.enabled?(:notification_creation)
rescue => e
handle_error(e)
end
Expand Down

0 comments on commit 8b1d246

Please sign in to comment.