Stubbed class methods in RSpec 1 remain stubbed in other examples

Updated . Posted . 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 snapshot .

This might be fixed Show snapshot in RSpec 2.

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