Revision
3423
Author
ernest.prabhakar@gmail.com
Date
2010-02-03 17:16:00 -0800 (Wed, 03 Feb 2010)

Log Message

Add/pass Dispatch :wrap specs

Modified Paths

Diff

Modified: MacRuby/trunk/spec/macruby/library/dispatch/dispatch_spec.rb (3422 => 3423)


--- MacRuby/trunk/spec/macruby/library/dispatch/dispatch_spec.rb	2010-02-04 01:15:53 UTC (rev 3422)
+++ MacRuby/trunk/spec/macruby/library/dispatch/dispatch_spec.rb	2010-02-04 01:16:00 UTC (rev 3423)
@@ -5,7 +5,7 @@
   
   $global = 0
   class Actee
-    def initialize(s); @s = s; end
+    def initialize(s="default"); @s = s; end
     def current_queue; Dispatch::Queue.current; end
     def delay_set(n); sleep 0.01; $global = n; end
     def increment(v); v+1; end
@@ -55,6 +55,21 @@
         $global.should == 42      
       end
     end
+
+    describe :wrap do
+      it "should return an Actor wrapping an instance of a passed class" do
+        actor = Dispatch.wrap(Actee)
+        actor.should be_kind_of Dispatch::Actor
+        actor.to_s.should == "default"
+      end
+
+      it "should return an Actor wrapping any other object" do
+        actor = Dispatch.wrap(@actee)
+        actor.should be_kind_of Dispatch::Actor
+        actor.to_s.should == "my_actee"
+      end
+    end
     
+    
   end
 end
\ No newline at end of file