<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>stump.gemspec</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -72,6 +72,10 @@ Stubbing and mocking that isn't painful, fanciful, and doesn't inspire any sort
     MyClass.proxy!(:the_method)
     # Returns static value but still has side effects of real method call
     MyClass.proxy!(:that_method, :return =&gt; &quot;poop&quot;)
+    
+== NOTES:
+
+* Be sure you call +super+ in +teardown+ if you create your own +teardown+ methods.  Otherwise your mocks won't get verified!
 
 == REQUIREMENTS:
 
@@ -83,6 +87,11 @@ Stubbing and mocking that isn't painful, fanciful, and doesn't inspire any sort
     $ sudo gem install jeremymcanally-stump
 
 
+== ACKNOWLEDGEMENTS:
+
+* Thanks to Jim Weirich for Flexmock, David Chelmisky et. al. for RSpec's mocking stuff, and Brian Takita for rr.  All of those things fed into stump.
+* BIG thanks to Nathan Sutton (fowlduck) for helping me work through how to get +proxy!+ to work with ActiveRecord/method_missing.
+
 == LICENSE:
 
 (The MIT License)</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -36,40 +36,68 @@ class Object
   def proxy!(method, options = {}, &amp;block)
     Stump::Mocks.add([self, method])
     
+    if respond_to?(method)
+      proxy_existing_method(method, options, &amp;block)
+    else
+      proxy_missing_method(method, options, &amp;block)
+    end
+  end
+  
+  protected
+  def proxy_existing_method(method, options = {}, &amp;block)
     method_alias = &quot;__old_#{method}&quot;
     
     meta_eval do
       module_eval(&quot;alias #{method_alias} #{method}&quot;)
     end
         
-    behavior = unless options[:return]
+    behavior = if options[:return]
                   lambda do |*args| 
                     raise ArgumentError if args.length != method(method_alias.to_sym).arity
-
-                    Stump::Mocks.verify([self, method])
                     
+                    Stump::Mocks.verify([self, method])
+
                     if method(method_alias.to_sym).arity == 0
-                      return send(method_alias)
+                      send(method_alias)
                     else
-                      return send(method_alias, *args)
+                      send(method_alias, *args)
                     end
+
+                    return options[:return]
                   end
                 else
                   lambda do |*args| 
                     raise ArgumentError if args.length != method(method_alias.to_sym).arity
-                    
-                    Stump::Mocks.verify([self, method])
 
+                    Stump::Mocks.verify([self, method])
+                    
                     if method(method_alias.to_sym).arity == 0
-                      send(method_alias)
+                      return send(method_alias)
                     else
-                      send(method_alias, *args)
+                      return send(method_alias, *args)
                     end
+                  end
+                end
 
+    meta_def method, &amp;behavior
+  end
+  
+  def proxy_missing_method(method, options = {}, &amp;block)
+    behavior = if options[:return]
+                  lambda do |*args|
+                    Stump::Mocks.verify([self, method])
+                    
+                    method_missing(method, args)
                     return options[:return]
                   end
+                else
+                  lambda do |*args|
+                    Stump::Mocks.verify([self, method])
+      
+                    method_missing(method, args)
+                  end
                 end
-
+    
     meta_def method, &amp;behavior
   end
 end
\ No newline at end of file</diff>
      <filename>lib/stump/proxy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,15 @@
 require File.dirname(__FILE__) + '/test_helper.rb'
 
+class ProxyPants
+  def method_missing(method_name, arguments)
+    if method_name.to_s =~ /fun_/
+      return &quot;whoo #{method_name} party!!&quot;
+    else
+      super
+    end
+  end
+end
+
 class TestProxy &lt; Test::Unit::TestCase
   def setup
   end
@@ -24,7 +34,7 @@ class TestProxy &lt; Test::Unit::TestCase
   
   def test_proxy_is_added_to_tracker
     proxy_me = MyStump.new
-    proxy_me.proxy!(:tree, &quot;tea&quot;)
+    proxy_me.proxy!(:tree, :return =&gt;  &quot;tea&quot;)
     
     assert_equal [[proxy_me, :tree]], Stump::Mocks.failures
   end
@@ -44,7 +54,7 @@ class TestProxy &lt; Test::Unit::TestCase
 
   def test_proxy_fail
     stumply = MyStump.new
-    stumply.proxy!(:tree, &quot;hi&quot;)
+    stumply.proxy!(:tree, :return =&gt; &quot;hi&quot;)
     
     assert_raise Test::Unit::AssertionFailedError do
       stumpdown!
@@ -53,7 +63,7 @@ class TestProxy &lt; Test::Unit::TestCase
   
   def test_proxy_pass
     stumply = MyStump.new
-    stumply.proxy!(:tree, &quot;hi&quot;)
+    stumply.proxy!(:tree, :return =&gt; &quot;hi&quot;)
     stumply.tree
     
     assert_nothing_raised do
@@ -61,6 +71,38 @@ class TestProxy &lt; Test::Unit::TestCase
     end
   end
   
+  def test_proxy_method_missing
+    obj = ProxyPants.new
+    
+    obj.proxy!(:fun_pants)
+    assert_equal &quot;whoo fun_pants party!!&quot;, obj.fun_pants
+  end
+  
+  def test_proxy_method_missing_with_return
+    obj = ProxyPants.new
+    
+    obj.proxy!(:fun_party, :return =&gt; &quot;party time in the city!!&quot;)
+    assert_equal &quot;party time in the city!!&quot;, obj.fun_party
+  end
+  
+  def test_proxy_method_missing_fails_with_no_method_match
+    obj = ProxyPants.new
+    
+    assert_raises NoMethodError do
+      obj.proxy!(:fail_pants)
+      obj.fail_pants
+    end
+  end
+  
+  def test_proxy_method_missing_fail
+    stumply = ProxyPants.new
+    stumply.proxy!(:fun_tree, :return =&gt; &quot;hello&quot;)
+    
+    assert_raise Test::Unit::AssertionFailedError do
+      stumpdown!
+    end
+  end
+  
   def teardown
     Stump::Mocks.clear!
   end</diff>
      <filename>test/test_proxy.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2683329c98f6c4768e752717e14520c0f1ad8b8f</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy McAnally</name>
    <email>jeremymcanally@gmail.com</email>
  </author>
  <url>http://github.com/jeremymcanally/stump/commit/c3bdba7bcd60f18f25f606c841744d2d8276a1ab</url>
  <id>c3bdba7bcd60f18f25f606c841744d2d8276a1ab</id>
  <committed-date>2008-10-07T20:38:20-07:00</committed-date>
  <authored-date>2008-10-07T20:38:20-07:00</authored-date>
  <message>Actually add gemspec this time, add acknowledgements to README (including fowlduck for his awesome idea), and fix proxying for AR/method_missing methods</message>
  <tree>2bf004da27121427a43c11095d7268f40adfaedc</tree>
  <committer>
    <name>Jeremy McAnally</name>
    <email>jeremymcanally@gmail.com</email>
  </committer>
</commit>
