I try to test this action in my functional test of controller
events_controller
From edit inplace
def edit_in_place
@event=Event.in_archive.find(params[:id])
@person=Person.current
if params[:attribute]
if @event.disweb_date.nil? : @event.build_disweb_date end
if @event.place.nil? : @event.build_place end
if @event.annotation.nil? : @event.build_annotation end
@event.source_references.build
@event.pictures.build
attribute=params[:attribute]
case attribute
when
‘name’,‘family_event’,‘description’,‘annotation’,‘source_references’,‘pictures’
:
render(:partial => “event” , :object => @event, :locals => { :person
=> @person, :attribute => attribute })
when ‘disweb_date’ : render(:partial =>
“disweb_date” , :object => @event.disweb_date, :locals => { :event =>
@event, :attribute => ‘the_date’ })
when ‘place’ : render(:partial => “place” , :object =>
@event.place, :locals => { :event => @event, :attribute =>
‘place’ })
end
end
end
with the shoulda test
should "allow editing of selected attribute" do
@event=Factory.create(:event, :name=>'fdd')
get :edit_in_place, {'attribute' => {'name'=>'fdd'},'id' =>
“#{@event.id}”}
assert_response :success
assert_not_nil assigns(:event)
assert_not_nil assigns(:event_presenter)
end
and gets the error – missing template events/edit_in_place.erb in
view path app/views
I have a partial events/_edit_in_place.hml.erb but it seems that the
tests assumes that an ordinary view is rendered with name
edit_in_place
I have tried assert_template :partial=>’_event_in_place’ and partial
‘_event’ that is used, but the error message is still there
How do I tell the get :edit_in_place that partias are to be
rendered ???
and how do I test that ?
I also test a similiar show action that render a partial _show and
that works withou any missing templates