Hello, Sometimes when we place expectations on class methods, the class methods seem to be not available in their previous form for other, later specs. Calling the class methods in other specs result in a no method error. We commonly find this happening when model specs run after controller specs - the Model.find expectations in controller specs make Model.find actual calls in model specs result in errors. Running them in reverse removes the errors. I'm wondering if I'm using RSpec wrong, or if it's a bug. My assumption is that after the example group in which the expectation has been placed, the original functionality of the class is restored. That's supposed to be the function of of Proxy#reset_proxied_methods, if I'm understanding the RSpec source correctly. Here's a link to a minimal, standalone, example of what I'm talking about, although it deals with define_method instead of find. The output we get when running the specs is in the pastie at the bottom, commented out. http://gist.github.com/22144 It's extracted from a Rails app but has been modified to be run on it's own, with no external dependencies or configuration. The error happens under 1.1.11 and also edge RSpec from github. We are seeing it on Mac 10.5 and also Ubuntu 8.04. jlindley@Hypatia:~/sites/cpi2/spec/models(master)$ spec -v rspec 1.1.11 jlindley@Hypatia:~/sites/cpi2/spec/models(master)$ ruby -v ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] Thanks! Jim Lindley
on 2008-11-04 16:34
on 2008-11-04 16:40
On Tue, Nov 4, 2008 at 9:32 AM, Jim Lindley <firstname.lastname@example.org> wrote: > I'm wondering if I'm using RSpec wrong, or if it's a bug. My > http://gist.github.com/22144 > ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] > > Thanks! > > Jim Lindley Hey Jim - I think this is related to this: http://rspec.lighthouseapp.com/projects/5645/tickets/589 Would you kindly add your comments to that ticket? Thanks, David
on 2008-11-04 16:58
> Hey Jim - I think this is related to this: > > http://rspec.lighthouseapp.com/projects/5645/tickets/589 > > Would you kindly add your comments to that ticket? > I updated the ticket, thanks David! I also changed the title to something more general then the existing case implied. It's not just Kernel that's affected in our case.
on 2008-11-05 01:58
I have created an updated example, the issue I am seeing happens when any method has been included into a class from a module. It doesn't get re-added like methods that have been inherited or added directly to a class are. http://gist.github.com/22159 I've updated the ticket as well, but I think it's a separate issue then the original ticket you directed me to. Thanks, Jim