diff options
Diffstat (limited to 'spec/support/shared_examples/services/alert_management/alert_processing')
-rw-r--r-- | spec/support/shared_examples/services/alert_management/alert_processing/alert_firing_shared_examples.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/spec/support/shared_examples/services/alert_management/alert_processing/alert_firing_shared_examples.rb b/spec/support/shared_examples/services/alert_management/alert_processing/alert_firing_shared_examples.rb index 6cae7d8e00f..0db9519f760 100644 --- a/spec/support/shared_examples/services/alert_management/alert_processing/alert_firing_shared_examples.rb +++ b/spec/support/shared_examples/services/alert_management/alert_processing/alert_firing_shared_examples.rb @@ -23,12 +23,10 @@ RSpec.shared_examples 'creates an alert management alert or errors' do end context 'and fails to save' do - let(:errors) { double(messages: { hosts: ['hosts array is over 255 chars'] }, '[]': [] )} - before do - allow(service).to receive(:alert).and_call_original - allow(service).to receive_message_chain(:alert, :save).and_return(false) - allow(service).to receive_message_chain(:alert, :errors).and_return(errors) + allow(AlertManagement::Alert).to receive(:new).and_wrap_original do |m, **args| + m.call(**args, hosts: ['a' * 256]) # hosts should be 255 + end end it_behaves_like 'alerts service responds with an error', :bad_request |