public
Description: All the extra stuff you could want for the Mack Framework.
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack-more.git
Added specs for Mack::Distributed::Object [#10]
markbates (author)
Tue Aug 05 12:33:47 -0700 2008
commit  05bfe9ca17d7bb89e1a5445d6fcb963b38e1f572
tree    d03df40ff1f5c088e421f2de111bbfee4906ee6c
parent  a2c8ed4331baeef0970640e3905ef7bab2728b32
...
2
3
4
5
 
6
7
...
2
3
4
 
5
6
7
0
@@ -2,6 +2,6 @@ require 'rake'
0
 require 'rake/testtask'
0
 require 'rake/rdoctask'
0
 
0
-gem 'mack', '0.6.0.100'
0
+gem 'mack'
0
 require 'mack_tasks'
0
 
...
6
7
8
 
 
 
 
 
 
 
 
 
 
9
10
11
...
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
0
@@ -6,6 +6,16 @@ module Mack
0
         base.class_eval do
0
           include ::DRbUndumped
0
         end
0
+        eval %{
0
+          class ::Mack::Distributed::#{base}Proxy < Mack::Utils::BlankSlate
0
+            include Singleton
0
+            include DRbUndumped
0
+
0
+            def method_missing(sym, *args)
0
+              #{base}.send(sym, *args)
0
+            end
0
+          end
0
+        }
0
       end
0
       
0
     end # Object
...
6
7
8
 
 
 
 
 
 
 
 
9
10
11
12
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
15
16
...
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
0
@@ -6,10 +6,38 @@ describe Mack::Distributed::Object do
0
 
0
   class Car
0
     include Mack::Distributed::Object
0
+    
0
+    def make
0
+      "Toyota"
0
+    end
0
+    
0
+    def self.buy
0
+    end
0
+    
0
   end
0
 
0
   it "should include DRbUndumped" do
0
     Car.new.should be_is_a(DRbUndumped)
0
   end
0
+  
0
+  it "should defined a proxy singleton" do
0
+    lambda{Mack::Distributed::BoatProxy}.should raise_error(NameError)
0
+    class Boat
0
+      include Mack::Distributed::Object
0
+    end
0
+    lambda{
0
+      Mack::Distributed::BoatProxy.instance.should_not be_nil
0
+      Mack::Distributed::BoatProxy.instance.should be_is_a(DRbUndumped)
0
+    }.should_not raise_error(NameError)
0
+  end
0
+  
0
+  it "should respond with the methods of the underlying class" do
0
+    car = Mack::Distributed::CarProxy.instance.new
0
+    car.should be_is_a(Car)
0
+    car.make.should == "Toyota"
0
+    car.respond_to?(:make).should == true
0
+    Mack::Distributed::CarProxy.instance.respond_to?(:buy).should == true
0
+  end
0
+  
0
 
0
 end
0
\ No newline at end of file
...
17
18
19
20
 
21
22
23
...
17
18
19
 
20
21
22
23
0
@@ -17,7 +17,7 @@ require 'extlib/hook'
0
 
0
 fl = File.join(File.dirname(__FILE__), "mack-facets")
0
 
0
-[:inflector, :inflections, :options_merger, :registry_list, :registry_map].each do |k|
0
+[:inflector, :inflections, :options_merger, :registry_list, :registry_map, :blank_slate].each do |k|
0
   path = File.join(fl, "utils", "#{k}")
0
   require path
0
 end

Comments