-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
"stack level too deep" when "expect().to receive().once" fails #2049
Comments
Hi @passalini Thanks for the issue. We need a little more detail to be able to reproduce this. Could you please provide us with a rails app that we can clone that demonstrates the issue. Specifically it'd be great if
then, provide us with a description of how to clone your application and reproduce the issue. Thanks :) |
Hi @samphippen I just added the project in the issue description. I hope that it helps! |
@passalini are you able to reproduce this without Devise? |
@samphippen without devise the mock works. You can see it on this build. |
as initially reported in rspec/rspec-rails#2049
as initially reported in rspec/rspec-rails#2049 The issue occurs when a class defines an `inspect` method which depends on methods that have been stubbed to e.g. `receive(...).at_most(n).times`. Failures try to call `inspect` which fails which calls `inspect` which ...
I believe this is actually an |
Ruby, Rails and RSpec versions
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
Rails 5.2.1
RSpec 3.8
Rails app with the following problem
repo: https://github.com/passalini/rspec-issue-2049
circle: https://circleci.com/gh/passalini/rspec-issue-2049/14
Observed behaviour
I'm currently updating an app from Rails 4.2 to 5 and I'm getting a strange behaviour with an old test that is green on 4.2 and red on 5. On Rails 5 some callbacks have changed and for that reason my test is breaking but the rspec output is wrong!
First it showed a huge log and I couldn't see the error. After putting a
rescue
I saw thestack level too deep
was throwed only when you call more than how much you had specified at the test.So, if you use
receive(:email).twice
the error is throwed at the third call.I changed the test to a more simple test and it is still showing a huge log and a wrong error. Bellow I sent the test and a part of the log...
Test:
Output with
rescue
:Output without
rescue
:The text was updated successfully, but these errors were encountered: