SystemStackError with Rspec any_instance.stub (1.9) #1813

Closed
tscolari opened this Issue Jul 14, 2012 · 2 comments

Comments

Projects
None yet
2 participants

I'm getting these errors when stubbing the .valid? method of an ActiveRecord model.

Question.any_instance.stub(:valid?).and_return(false)
Failure/Error: let(:question) { FactoryGirl.create(:question) }
SystemStackError:
  SystemStackError
# kernel/common/kernel.rb:241:in `tap'
# ./spec/controllers/api/questions_controller_spec.rb:8:in `Api'
# kernel/common/eval19.rb:45:in `instance_eval'
# kernel/common/hash19.rb:257:in `fetch'
# ./spec/controllers/api/questions_controller_spec.rb:89:in `Api'
# kernel/common/eval19.rb:45:in `instance_eval'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/loader.rb:714:in `run_at_exits'
# kernel/loader.rb:734:in `epilogue'
# kernel/loader.rb:864:in `main'

##-> ./spec/controllers/api/questions_controller_spec.rb:8 is the FactoryGirl.create call


Failure/Error: post :create, question: FactoryGirl.attributes_for(:question), format: :json
SystemStackError:
  SystemStackError
# ./app/controllers/api/questions_controller.rb:24:in `create'
# kernel/common/throw_catch19.rb:8:in `catch'
# kernel/common/throw_catch.rb:10:in `register'
# kernel/common/throw_catch19.rb:7:in `catch'
# ./spec/controllers/api/questions_controller_spec.rb:45:in `Api'
# kernel/common/eval19.rb:45:in `instance_eval'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/loader.rb:714:in `run_at_exits'
# kernel/loader.rb:734:in `epilogue'
# kernel/loader.rb:864:in `main'

##-> /app/controllers/api/questions_controller.rb:24 is the .save call

The test that contains the stub passes, but all the others after it, that call valid?, get the SystemStackError error.
Maybe I'm doing something wrong, or this is a rspec error, but the same tests pass with mri 1.9.3

$ruby -v
rubinius 2.0.0dev (1.9.3 b9247312 yyyy-mm-dd JI) [x86_64-apple-darwin11.4.0]

$gem list rspec
*** LOCAL GEMS ***

rspec (2.11.0)
rspec-core (2.11.0)
rspec-expectations (2.11.1)
rspec-mocks (2.11.1)
rspec-rails (2.11.0)
Owner

dbussink commented Jul 26, 2012

Could you setup an app for this and publish it somewhere? That makes it a lot easier for us to reproduce. Now we need to setup a Rails (I at least assume this is Rails) app without knowing which gems etc. you have installed.

Sorry for the delay,

I created an repo with an app that gives the error at: https://github.com/tscolari/RubiniusAndRspecStubError
If you run the tests with mri and rbx you see the difference.

@mtaylor mtaylor referenced this issue in aeolus-incubator/tim Oct 11, 2012

Merged

Templates and nesting fixes #44

dbussink added a commit that referenced this issue Oct 27, 2012

Add spec for double aliasing method with super call
This is a spec for the extracted behavior from issue #1813.

@dbussink dbussink closed this in 5067035 Oct 27, 2012

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