[Rails] Production/test diferences (long)

Josef Pospíšil pepe at gravastar.cz
Sun Nov 14 11:50:11 GMT 2004


Hello,

I've got some troubles, when I'm reimplementing my first rails  
application with tests. I got view, which normaly render on production  
system. Code is clear I think:

code:
	<%= form_tag({ :action => @target }) %>
	<%= hidden_field "question", "id" %>	
		<h3>Text:</h3>
		<%= text_area "question", "text", "cols" => 60 %>
		<h3>Okruh:</h3>
		<select name="question[area_id]">
		<%=
		options_for_select(get_areas, @question.area.id) %>
		</select>
		<input type="submit" value="Ulozit" />
	</form>

It's in the partial, so I can use this form for more views.

But the problem arise, when I'm trying to do functional tests. It  
yields to:

stact_trace:
	ActionView::TemplateError: wrong number of arguments (0 for 1)
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:172:in  
`render_file'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:180:in  
`render'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_view/partials.rb:37: 
in `render_partial'
     (erb)...
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:191:in  
`render_template'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:166:in  
`render_file'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/layout.rb: 
136:in `render_without_benchmark'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ 
benchmarking.rb:22:in `render'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ 
benchmarking.rb:22:in `measure'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ 
benchmarking.rb:22:in `render'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/base.rb: 
564:in `perform_action_without_filters'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ 
filters.rb:236:in `perform_action_without_benchmark'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ 
benchmarking.rb:30:in `perform_action_without_rescue'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ 
benchmarking.rb:30:in `measure'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ 
benchmarking.rb:30:in `perform_action_without_rescue'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/rescue.rb: 
68:in `perform_action'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/base.rb: 
254:in `process'
      
/opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ 
test_process.rb:192:in `process'
     ./test/functional/qadmin_controller_test.rb:50:in `test_new'
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = process "new"

Maybe I'm doing something wrong, but I can't see any way how to work  
around. The worst thing is that it's *only* in tests :-(.

Thanks for any help or suggestion.

Pepe



More information about the Rails mailing list