Title: [waffle-scm] [248] trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb: added spec for Waffle::Controller locate(type) instance method
Revision
248
Author
mward
Date
2007-07-09 16:12:46 -0500 (Mon, 09 Jul 2007)

Log Message

added spec for Waffle::Controller locate(type) instance method

Modified Paths


Diff

Modified: trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb (247 => 248)

--- trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb	2007-07-09 20:55:37 UTC (rev 247)
+++ trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb	2007-07-09 21:12:46 UTC (rev 248)
@@ -61,9 +61,9 @@
 
 end
 
-describe "Waffle::Controller module" do
+describe "The '__set_all_contexts' Waffle::Controller instance method" do
 
-  it "__set_all_contexts should process request, response, session attributes as well as request parameters" do
+  it "should process request, response, session attributes as well as request parameters" do
     controller = Object.new
     controller.send(:extend, Waffle::Controller)
 
@@ -94,5 +94,35 @@
     controller.parameters['foo'].should == 'bar'
   end
 
+end
 
+describe "The 'locate' Waffle::Controller instance method" do
+
+  it "should handle when type passed in is a Module" do
+    module Foo
+      def self.java_class; return 'foobar'; end
+    end
+
+    controller = Object.new
+    controller.send(:extend, Waffle::Controller)
+
+    pico = mock('pico')
+    pico.should_receive(:getComponentInstanceOfType).with('foobar')
+    controller.__pico_container = pico
+
+    
+    controller.locate(Foo)
+  end
+
+  it "should handle when type passed in is NOT a Module" do
+    controller = Object.new
+    controller.send(:extend, Waffle::Controller)
+
+    pico = mock('pico')
+    pico.should_receive(:getComponentInstance).with('foobar')
+    controller.__pico_container = pico
+
+    controller.locate('foobar')
+  end
+
 end
\ No newline at end of file


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to