Class: Polyn::Testing
- Inherits:
-
Object
- Object
- Polyn::Testing
- Defined in:
- lib/polyn/testing.rb,
lib/polyn/testing/mock_msg.rb,
lib/polyn/testing/mock_nats.rb,
lib/polyn/testing/mock_jetstream.rb,
lib/polyn/testing/mock_pull_subscription.rb
Overview
Test helpers to help keep tests predictable
Defined Under Namespace
Classes: MockJetStream, MockMsg, MockNats, MockPullSubscription
Class Method Summary collapse
-
.setup(**_opts) ⇒ Object
Use this in spec_helper.rb to include a shared_context that can be used with
include_context :polyn.
Class Method Details
.setup(**_opts) ⇒ Object
Use this in spec_helper.rb to include a shared_context that can be
used with include_context :polyn
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/polyn/testing.rb', line 13 def self.setup(**_opts) conn = NATS.connect schema_store = Polyn::SchemaStore.new(conn) RSpec.shared_context :polyn do before(:each) do # Have a global, shared schema store that only pulls the schemas # once for the whole test suite. For testing an application the # schemas are expected to be the same throughout the whole suite Thread.current[:polyn_schema_store] = schema_store end after(:each) do Thread.current[:polyn_schema_store] = nil end end end |