[ap4r-devel] [366] trunk: Fix: exception in calling a class method for an instance.

shino at rubyforge.org shino at rubyforge.org
Thu Jan 17 04:24:34 EST 2008


Revision: 366
Author:   shino
Date:     2008-01-17 04:24:32 -0500 (Thu, 17 Jan 2008)

Log Message:
-----------
Fix: exception in calling a class method for an instance.
Add: A RSpec example for Ap4r::StoredMessage#dumped_headers
Add: A RSpec example for Ap4r::StoredMessage#dumped_object

Modified Paths:
--------------
    trunk/ap4r/lib/ap4r/stored_message.rb
    trunk/samples/HelloWorld/spec/models/stored_message_spec.rb

Modified: trunk/ap4r/lib/ap4r/stored_message.rb
===================================================================
--- trunk/ap4r/lib/ap4r/stored_message.rb	2008-01-11 04:58:54 UTC (rev 365)
+++ trunk/ap4r/lib/ap4r/stored_message.rb	2008-01-17 09:24:32 UTC (rev 366)
@@ -31,7 +31,7 @@
     
     def dumped_headers
       # The warning occurs when putting backslash into binaly type in PostgreSQL.
-      if postgresql?
+      if self.class.postgresql?
         self.headers
       else
         Marshal::dump(self.headers)
@@ -40,7 +40,7 @@
     
     def dumped_object
       # The warning occurs when putting backslash into binaly type in PostgreSQL.
-      if postgresql?
+      if self.class.postgresql?
         self.object
       else
         Marshal::dump(self.object)

Modified: trunk/samples/HelloWorld/spec/models/stored_message_spec.rb
===================================================================
--- trunk/samples/HelloWorld/spec/models/stored_message_spec.rb	2008-01-11 04:58:54 UTC (rev 365)
+++ trunk/samples/HelloWorld/spec/models/stored_message_spec.rb	2008-01-17 09:24:32 UTC (rev 366)
@@ -65,4 +65,23 @@
 
     Order.should have(:no).records
   end
+
 end
+
+describe Ap4r::StoredMessage, "when dumping its headers" do
+  it "should not raise Exceptions" do
+    lambda {
+      s = Ap4r::StoredMessage.new
+      s.dumped_headers
+    }.should_not raise_error
+  end
+end
+
+describe Ap4r::StoredMessage, "when dumping its object" do
+  it "should not raise Exceptions" do
+    lambda {
+      s = Ap4r::StoredMessage.new
+      s.dumped_object
+    }.should_not raise_error
+  end
+end




More information about the ap4r-devel mailing list