Module: Karafka::Testing
- Defined in:
- lib/karafka/testing.rb,
lib/karafka/testing/errors.rb,
lib/karafka/testing/helpers.rb,
lib/karafka/testing/version.rb,
lib/karafka/testing/rspec/proxy.rb,
lib/karafka/testing/rspec/helpers.rb,
lib/karafka/testing/minitest/proxy.rb,
lib/karafka/testing/minitest/helpers.rb,
lib/karafka/testing/spec_consumer_client.rb,
lib/karafka/testing/spec_producer_client.rb
Overview
Testing lib module
Defined Under Namespace
Modules: Errors, Helpers, Minitest, RSpec Classes: SpecConsumerClient, SpecProducerClient
Constant Summary collapse
- VERSION =
Current version of gem. It should match Karafka framework version
'2.4.6'
Class Method Summary collapse
-
.ensure_karafka_initialized! ⇒ Object
If you do not initialize Karafka always within your specs, do not include/use this lib in places where Karafka would not be loaded.
-
.ensure_karafka_loaded! ⇒ Object
Makes sure, that we do not use the testing stubs, etc when Karafka app is not loaded.
Class Method Details
.ensure_karafka_initialized! ⇒ Object
If you do not initialize Karafka always within your specs, do not include/use this lib in places where Karafka would not be loaded.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/karafka/testing.rb', line 23 def ensure_karafka_initialized! ensure_karafka_loaded! return unless Karafka::App.initializing? raise( Karafka::Testing::Errors::KarafkaNotInitializedError, 'Make sure to initialize Karafka framework prior to usage of the testing components.' ) end |
.ensure_karafka_loaded! ⇒ Object
Makes sure, that we do not use the testing stubs, etc when Karafka app is not loaded
You should never use karafka-testing primitives when framework is not loaded because testing lib stubs certain pieces of Karafka that need to be initialized.
12 13 14 15 16 17 18 19 |
# File 'lib/karafka/testing.rb', line 12 def ensure_karafka_loaded! return if ::Karafka.const_defined?('App', false) raise( Karafka::Testing::Errors::KarafkaNotLoadedError, 'Make sure to load Karafka framework prior to usage of the testing components.' ) end |