diff --git a/spec/datadog/appsec/actions_handler_spec.rb b/spec/datadog/appsec/actions_handler_spec.rb index 3383c3db6d7..7678fc755d3 100644 --- a/spec/datadog/appsec/actions_handler_spec.rb +++ b/spec/datadog/appsec/actions_handler_spec.rb @@ -21,25 +21,22 @@ end it 'calls generate_stack with action parameters' do - expect(described_class).to( - receive(:generate_stack).with(generate_stack_action['generate_stack']).and_call_original - ) + expect(described_class).to receive(:generate_stack) + .with(generate_stack_action['generate_stack']).and_call_original described_class.handle(generate_stack_action) end it 'calls generate_schema with action parameters' do - expect(described_class).to( - receive(:generate_schema).with(generate_schema_action['generate_schema']).and_call_original - ) + expect(described_class).to receive(:generate_schema) + .with(generate_schema_action['generate_schema']).and_call_original described_class.handle('generate_schema' => generate_schema_action['generate_schema']) end it 'calls redirect_request with action parameters' do - expect(described_class).to( - receive(:redirect_request).with(redirect_request_action['redirect_request']).and_call_original - ) + expect(described_class).to receive(:redirect_request) + .with(redirect_request_action['redirect_request']).and_call_original catch(Datadog::AppSec::Ext::INTERRUPT) do described_class.handle(redirect_request_action) @@ -47,9 +44,8 @@ end it 'calls block_request with action parameters' do - expect(described_class).to( - receive(:block_request).with(block_request_action['block_request']).and_call_original - ) + expect(described_class).to receive(:block_request) + .with(block_request_action['block_request']).and_call_original catch(Datadog::AppSec::Ext::INTERRUPT) do described_class.handle(block_request_action) @@ -57,9 +53,9 @@ end it 'calls redirect_request only when both block_request and redirect_request are present' do - expect(described_class).to( - receive(:redirect_request).with(redirect_request_action['redirect_request']).and_call_original - ) + expect(described_class).to receive(:redirect_request) + .with(redirect_request_action['redirect_request']).and_call_original + expect(described_class).not_to receive(:block_request) catch(Datadog::AppSec::Ext::INTERRUPT) do @@ -68,23 +64,21 @@ end it 'calls both generate_stack and generate_schema when both are present' do - expect(described_class).to( - receive(:generate_stack).with(generate_stack_action['generate_stack']).and_call_original - ) - expect(described_class).to( - receive(:generate_schema).with(generate_schema_action['generate_schema']).and_call_original - ) + expect(described_class).to receive(:generate_stack) + .with(generate_stack_action['generate_stack']).and_call_original + + expect(described_class).to receive(:generate_schema) + .with(generate_schema_action['generate_schema']).and_call_original described_class.handle(generate_stack_action.merge(generate_schema_action)) end it 'calls both generate_stack and block_request when both are present' do - expect(described_class).to( - receive(:generate_stack).with(generate_stack_action['generate_stack']).and_call_original - ) - expect(described_class).to( - receive(:block_request).with(block_request_action['block_request']).and_call_original - ) + expect(described_class).to receive(:generate_stack) + .with(generate_stack_action['generate_stack']).and_call_original + + expect(described_class).to receive(:block_request) + .with(block_request_action['block_request']).and_call_original catch(Datadog::AppSec::Ext::INTERRUPT) do described_class.handle(generate_stack_action.merge(block_request_action)) @@ -92,12 +86,11 @@ end it 'calls both generate_stack and redirect_request when both are present' do - expect(described_class).to( - receive(:generate_stack).with(generate_stack_action['generate_stack']).and_call_original - ) - expect(described_class).to( - receive(:redirect_request).with(redirect_request_action['redirect_request']).and_call_original - ) + expect(described_class).to receive(:generate_stack) + .with(generate_stack_action['generate_stack']).and_call_original + + expect(described_class).to receive(:redirect_request) + .with(redirect_request_action['redirect_request']).and_call_original catch(Datadog::AppSec::Ext::INTERRUPT) do described_class.handle(generate_stack_action.merge(redirect_request_action))