Module: Tpt::Rails::EventBridgeTestHelper
- Defined in:
- app/helpers/tpt/rails/event_bridge_test_helper.rb
Class Method Summary collapse
-
.publisher(batch_size: 10, stub_responses: {}) ⇒ EventBridgePublisher
@description: Instantiates an EventBridgePublisher ready for testing.
Class Method Details
.publisher(batch_size: 10, stub_responses: {}) ⇒ EventBridgePublisher
@description: Instantiates an EventBridgePublisher ready for testing. AWS and DataDog info is faked. Note that this sets the
metrics object for the class to be a stub. The AWS EventBridge gem will never actually be called as the gem's
#put_events method is replaced with a stub.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/tpt/rails/event_bridge_test_helper.rb', line 11 def self.publisher(batch_size: 10, stub_responses: {}) Tpt::Rails::EventBridgePublisher.set_metrics( Datadog::Statsd.new('localhost', 8125) ) Tpt::Rails::EventBridgePublisher.new( event_source: ENV.fetch('TPT_EVENT_SOURCE', 'test-source'), batch_size: batch_size, client_options: { access_key_id: '1234', secret_access_key: 'abcd', stub_responses: stub_responses } ) end |