[macruby-changes] [3423] MacRuby/trunk/spec/macruby/library/dispatch/dispatch_spec.rb

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 3 17:16:00 PST 2010


Revision: 3423
          http://trac.macosforge.org/projects/ruby/changeset/3423
Author:   ernest.prabhakar at gmail.com
Date:     2010-02-03 17:16:00 -0800 (Wed, 03 Feb 2010)
Log Message:
-----------
Add/pass Dispatch :wrap specs

Modified Paths:
--------------
    MacRuby/trunk/spec/macruby/library/dispatch/dispatch_spec.rb

Modified: MacRuby/trunk/spec/macruby/library/dispatch/dispatch_spec.rb
===================================================================
--- 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100203/bb6ee277/attachment-0001.html>


More information about the macruby-changes mailing list