-
-
Notifications
You must be signed in to change notification settings - Fork 1k
have_enqueued_mail
raising undefined method to_sym
for Hash
#2575
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
Comments
Thanks for reporting. It would be very helpful if you could provide a reproducible example. |
@pirj pushed an rspec rails repro repo (say that again!) https://github.com/jasonkarns/fluffy-octo-memory single model without anything special; single mailer. |
have_enqueued_mail
raising error: undefined method `to_sym' for {}:Hashhave_enqueued_mail
raising undefined method `to_sym' for Hash
have_enqueued_mail
raising undefined method `to_sym' for Hashhave_enqueued_mail
raising undefined method to_sym
for Hash
I just installed ruby 2.7.5 and still reproduced. (So you shouldn't need to downgrade to 2.7.3 if you don't wish to)
|
There's definitely a bug in this line: keywords.each_with_object({}) { |new_hash, keyword| puts new_hash, keyword; new_hash[keyword.to_sym] = hash[keyword] } Block arguments should be the other way around, It's still surprising that this bug has gotten through all of our lines of defence, and how to write a spec to prevent this from re-appearing. Would you like to hack on it? |
Its the result of a munged rubocop fix, it was initially a Spec wise we miss this because we don't test with an active record object, if you change the repro spec to use a string it doesn't encounter the bug. I've tried to work up a repo with a fake global id job in our suite which isn't enough, and an active record one but it complains about it not being serialisable |
I was able to repro with a non-AR class by ensuring the job's param matched GlobalID::Identification: jasonkarns/fluffy-octo-memory@6dc4eab
|
Nice! Would you like to send a PR with an added spec for this? |
I had a more complex example, but that actually works better, does not reproduce the issue within our test suite though |
Quick suggestion. Would
cd /Users/jasonkarns/Projects/rspec/rspec-expectations
git checkout main
git pull
work? It seems to find the repo locally, but the code there seems to be aged.
|
Yep, apologies. I deleted my comment as soon as I realized it was due to old sibling repos. |
The key to reproducing this was the fact it needed to be tested using a unified mailer which is a later Rails default than our base level |
Closed in #2578 and released as 5.1.1 |
What Ruby, Rails and RSpec versions are you using?
Issue does not manifest on rspec-rails 5.0.2
Observed behaviour
With the following spec:
We get:
Full backtrace
Expected behaviour
This was a passing test before upgrading to rspec-rails 5.0.3
Can you provide an example app?
https://github.com/jasonkarns/fluffy-octo-memory
I presume this is the result of #2566 (and related to #2570 ).
The text was updated successfully, but these errors were encountered: