Class: Polyn::Testing::MockJetStream
- Inherits:
-
Object
- Object
- Polyn::Testing::MockJetStream
- Defined in:
- lib/polyn/testing/mock_jetstream.rb
Overview
Mock JetStream for applications to use in testing
Instance Method Summary collapse
- #consumer_info(stream, consumer_name) ⇒ Object
- #find_stream_name_by_subject(subject) ⇒ Object
-
#initialize(mock_nats) ⇒ MockJetStream
constructor
A new instance of MockJetStream.
- #pull_subscribe(subject, consumer_name) ⇒ Object
Constructor Details
#initialize(mock_nats) ⇒ MockJetStream
Returns a new instance of MockJetStream.
8 9 10 11 |
# File 'lib/polyn/testing/mock_jetstream.rb', line 8 def initialize(mock_nats) @mock_nats = mock_nats @real_nats = mock_nats.nats end |
Instance Method Details
#consumer_info(stream, consumer_name) ⇒ Object
13 14 15 |
# File 'lib/polyn/testing/mock_jetstream.rb', line 13 def consumer_info(stream, consumer_name) @real_nats.jetstream.consumer_info(stream, consumer_name) end |
#find_stream_name_by_subject(subject) ⇒ Object
17 18 19 |
# File 'lib/polyn/testing/mock_jetstream.rb', line 17 def find_stream_name_by_subject(subject) @real_nats.jetstream.find_stream_name_by_subject(subject) end |
#pull_subscribe(subject, consumer_name) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/polyn/testing/mock_jetstream.rb', line 21 def pull_subscribe(subject, consumer_name) Polyn::Testing::MockPullSubscription.new( @mock_nats, subject: subject, consumer_name: consumer_name, ) end |