Ruby Rspec Expect Any Instance Of

Rspec can you stub a method that doesn t exist on an object or mock an object that can take any method.
Ruby rspec expect any instance of. John to a end end unable to validate method chain. Expect hash to call to a. Require spec helper describe do it do expect any instance of hash to receive to a name. Using any instance from rspec mocks old should syntax without explicitly enabling the syntax is deprecated.
This rspec style guide outlines the recommended best practices for real world programmers to write code that can be maintained by other real world programmers. Rubocop a static code analyzer linter and formatter has a rubocop rspec extension provides a way to enforce the rules outlined in this guide. More than 1 year has passed since last update. Does that indicate that the segfault is fixed in trunk and there may be a different bug in rspec causing the stack overflow in the first place p ruby master bug 9757.
Use the new expect syntax or explicitly enable should instead. That log excert is from a one off dyno a la heroku run console this is entirely seperate to your web dynos which you may be runnning 2x dyno s for. You need to specifiy size 2x in your heroku run command to have the one off process use 2x dynos. The following spec causes a segfault for me in ruby 2 1 1 on os x 10 9 2.
This test is successful. Class a def a a end end class b def b b end end describe segfault do it should make unused recorders do expect any instance of a to receive a expect any instance of b to receive b end it should crash ruby do a new a b new b end end. Segfault in 2 1 1 from rspec expect any instance of. Rspec provides no special mechanisms to access elements under test so yes you would need to somehow stub the id method and have it return whatever you wish e g.