Skip to content
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

Open
passalini opened this issue Dec 18, 2018 · 5 comments
Open

"stack level too deep" when "expect().to receive().once" fails #2049

passalini opened this issue Dec 18, 2018 · 5 comments

Comments

@passalini
Copy link

passalini commented Dec 18, 2018

Ruby, Rails and RSpec versions

ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
Rails 5.2.1
RSpec 3.8

  • rspec-core 3.8.0
  • rspec-expectations 3.8.2
  • rspec-mocks 3.8.0
  • rspec-rails 3.8.1
  • rspec-support 3.8.0

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 the stack 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:

it 'should show only 2 times' do
  expect(@student).to     receive(:email).once.and_call_original
  @student.email
  @student.email
end

Output with rescue:

Failure/Error: expect(student).to     receive(:email).once.and_call_original

       (#<Student id: 811082057, first_name: "Anitta", last_name: "MC", email: "[email protected]", cpf: "35171617210", phone: "(21) 99544-3049", skype: nil, company_name: nil, company_position: nil, born_at: "1993-03-30", biography: nil, cover_image_url: "https://lh6.googleusercontent.com/-sBdeyWCqDgE/AAA...", created_at: "2018-12-18 18:17:14", updated_at: "2018-12-18 18:17:14", organization_id: 1, role_id: nil, twitter: nil, facebook: nil, username: nil, see_all: false, rg: "26.412.324-5", extra_phone: nil, session_token: nil >).email(*(any args))
           expected: 1 time with any arguments
           received: 659 times with any arguments

Output without rescue:

   # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `block in serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `each'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activemodel-5.2.1/lib/active_model/serialization.rb:137:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/activerecord-5.2.1/lib/active_record/serialization.rb:19:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:116:in `serializable_hash'
     # /Users/passalini/.rbenv/versions/2.5.1/gemsets/Core/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:122:in `inspect'
     # ./spec/serializers/student_serializer_spec.rb:89:in `block (5 levels) in <top (required)>'

Finished in 1.09 seconds (files took 15.24 seconds to load)
1 example, 1 failure
@fables-tales
Copy link
Member

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

  1. you could rails new an application and commit
  2. make all the changes necessary to reproduce the issue and commit

then, provide us with a description of how to clone your application and reproduce the issue.

Thanks :)

@passalini
Copy link
Author

Hi @samphippen

I just added the project in the issue description.
I added the project to the circleci too.

I hope that it helps!

@fables-tales
Copy link
Member

@passalini are you able to reproduce this without Devise?

@passalini
Copy link
Author

@samphippen without devise the mock works. You can see it on this build.

jamesdabbs-procore added a commit to jamesdabbs-procore/rspec-mocks that referenced this issue May 3, 2019
jamesdabbs-procore added a commit to jamesdabbs-procore/rspec-mocks that referenced this issue May 3, 2019
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 ...
@jamesdabbs-procore
Copy link
Contributor

I believe this is actually an rspec-mocks issue. See rspec/rspec-mocks#1275 for a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants