Stubbed class methods in RSpec 1 remain stubbed in other examples

Posted Almost 13 years ago. Visible to the public.

I encountered a bug in RSpec 1.x where stubbed class methods ("static methods") would not be unstubbed before the next example, causing it to fail. This behavior can come and go as you edit your specs, since this can change the order in which RSpec evaluates your .rb files.

I was not able to find a fix for this behavior. Calling #rspec_reset und #unstub!(:method) on the class after the example did not help. I know for sure that stubbing static methods has not been a problem in many other projects. I encountered the bug while working on Cucumber Factory Show archive.org snapshot .

This might be fixed Show archive.org snapshot in RSpec 2.

Henning Koch
Last edit
Over 11 years ago
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2011-06-12 12:17)