karafka/karafka-testing

Error in v2.3.1: undefined method `ensure_karafka_initialized!' for Karafka::Testing:Module

Closed this issue · 4 comments

Just caught this error in our CI when upgrading karafka-testing via Dependabot.

We don't automatically require our gems in the Gemfile and, following the testing docs, we had only this in spec_helper:

require 'karafka/testing/rspec/helpers'

RSpec.configure do |config|
  config.include Karafka::Testing::RSpec::Helpers
end

Simply adding require 'karafka/testing' as well fixed the issue. Not sure if this is a bug or the documentation should be updated.

Testing docs say:

gem 'karafka-testing'

and not

gem 'karafka-testing', require: false

Though I agree @Drowze that maybe I should just require the root from the rspec require. Let me reopen and do this with the next release!

Understood about not having require: false in docs, but then Karafka is assuming its clients have Bundler.require(...) somewhere in their code - which I think is a fair assumption for Rails apps, but not so much in other ruby apps (we're running Karafka in a few Rails apps, but also inside Hanami).

Fair enough :) it shall be fixed. Thank you for reporting that!