Solved it
Used the wrong paprams and then the test took a way trough the code
that assumed the existence of an edit_in_place view
{'attribute' => {'name'=>'född'}
should be {'attribute' => {'name'}
On 6 Juli, 12:57, Hans <[email protected]> wrote:
> Still same problem
> I try once more
> get :edit_in_place,
> {'attribute' => {'name'=>'född'},'id' => "#[email protected]}"}
>
> On 6 Juli, 12:53, Hans <[email protected]> wrote:
>
>
>
>
>
>
>
> > Problemn with the copying
> > The get :edit_in_place in the test should be
>
> > get :edit_in_place, {'attribute' => {'name'=>'född'},'id' =>
> > "#[email protected]}"}
>
> > On 6 Juli, 12:44, Hans <[email protected]> wrote:
>
> > > 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=>'född')
> > > get :edit_in_place, {'attribute' => {'name'=>'född'},'id' =>
> > > "#[email protected]}"}
> > > 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
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.