-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
karafka helpers initialize described_class
, they shouldn't
#106
Comments
I have an error that is different, but the cause is the same as the one described by @ojab I am testing a API request in my Rails app and I have defined a subject to run it, subject(:action) { get "/books/#{book_id}/position" } During the request processing, we are producing a Kafka event and since I have added the For the moment the quick fix I found is to change my subject declaration to let(:action) { get "/books/#{book_id}/position" } |
Let me try to reproduce both... ok I can reproduce the first one |
Ok @ojab @NotGrm my suggestion here would be for me to:
This would mean we force a naming convention where consumer needs to be built with a I do not see any other way and I made a POC here: #108 Feel free to also check if it solves your problems. It works for me |
I agree with you, there seem to not be other ways than using a named reference instead of an implicit subject. But I'm wondering if it could not be possible to define this consumer reference automatically based on the described class properties 🤔 I'm not used to RSpec metaprog but maybe we could have something like
|
sounds like too much 🪄 to me tbh. Checking descendants, figuring things and building instead of just invoking consumer creation? Isn't it too much? I think it may be worth considering in a separate change though. Would you mind doing two things for me?
This fix does not contradict the other so we should be fine with patch release if solves both of your problems. |
closing. It will be released up to 15 minutes. |
🚀 karafka-testing 2.0.5 has been released: https://rubygems.org/gems/karafka-testing/versions/2.0.6 |
Consider the following innocent spec:
#=>
https://github.com/karafka/karafka-testing/blob/master/lib/karafka/testing/rspec/helpers.rb#L87-L94
https://github.com/rspec/rspec-core/blob/main/lib/rspec/core/memoized_helpers.rb#L57-L62
so by calling
subject
we're trying to initialize the class that requires some arguments.The text was updated successfully, but these errors were encountered: