Module: JetstreamBridge::TestHelpers::MockNats

Defined in:
lib/jetstream_bridge/test_helpers/mock_nats.rb

Overview

In-memory mock for NATS JetStream connection Simulates the NATS::IO::Client and JetStream API without requiring a real server

Defined Under Namespace

Classes: InMemoryStorage, MockAck, MockApiResponse, MockConnection, MockConsumer, MockJetStream, MockMessage, MockStream, MockSubscription

Class Method Summary collapse

Class Method Details

.create_mock_connectionObject

Factory method to create a mock connection



510
511
512
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 510

def self.create_mock_connection
  MockConnection.new
end

.reset!Object



519
520
521
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 519

def self.reset!
  @storage&.reset!
end

.storageObject

Global storage accessor for testing



515
516
517
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 515

def self.storage
  @storage ||= InMemoryStorage.new
end