- Revision
- 247
- Author
- mward
- Date
- 2007-07-09 15:55:37 -0500 (Mon, 09 Jul 2007)
Log Message
added rspec tests for Waffle::Controller.__set_all_contexts
Modified Paths
- trunk/core/core.iml
- trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb
- trunk/waffle.ipr
Diff
Modified: trunk/core/core.iml (246 => 247)
--- trunk/core/core.iml 2007-07-09 14:35:47 UTC (rev 246) +++ trunk/core/core.iml 2007-07-09 20:55:37 UTC (rev 247) @@ -160,6 +160,15 @@ </SOURCES> </library> </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> <orderEntryProperties /> </component> </module>
Modified: trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb (246 => 247)
--- trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb 2007-07-09 14:35:47 UTC (rev 246) +++ trunk/core/src/test/specs/org/codehaus/waffle/servlet/waffle_spec.rb 2007-07-09 20:55:37 UTC (rev 247) @@ -59,4 +59,40 @@ waffle_context.foo('bar').should == "success" end +end + +describe "Waffle::Controller module" do + + it "__set_all_contexts should process request, response, session attributes as well as request parameters" do + controller = Object.new + controller.send(:extend, Waffle::Controller) + + servlet_context = mock('servlet context') + session = mock('session') + session.should_receive(:getServletContext).and_return(servlet_context) + + # Using Hashtable because we need to an enumerator for testing + parameters = Hashtable.new + parameters.put('foo', "junk") + + request = mock('request') + request.should_receive(:getSession).with(false).and_return(session) + request.should_receive(:getParameterNames).and_return(parameters.keys) + request.should_receive(:getParameter).with('foo').and_return('bar') + + response = mock('response') + + Waffle::WebContext.should_receive(:new).with(request).and_return(request) # return same mock to keep test simple + Waffle::WebContext.should_receive(:new).with(session).and_return(session) # return same mock to keep test simple + Waffle::WebContext.should_receive(:new).with(servlet_context) + + controller.should_receive(:__process_request_params) + + controller.__set_all_contexts(request, response) + + # Ensure parameters set correctly + controller.parameters['foo'].should == 'bar' + end + + end \ No newline at end of file
Modified: trunk/waffle.ipr (246 => 247)
--- trunk/waffle.ipr 2007-07-09 14:35:47 UTC (rev 246) +++ trunk/waffle.ipr 2007-07-09 20:55:37 UTC (rev 247) @@ -352,11 +352,6 @@ </value> </option> </component> - <component name="uidesigner-configuration"> - <option name="INSTRUMENT_CLASSES" value="true" /> - <option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" /> - <option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" /> - </component> <UsedPathMacros> <macro name="M2_REPOSITORY" /> </UsedPathMacros>
To unsubscribe from this list please visit:
