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'' => "#{@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 -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Problemn with the copying The get :edit_in_place in the test should be get :edit_in_place, {''attribute'' => {''name''=>''född''},''id'' => "#{@event.id}"} On 6 Juli, 12:44, Hans <Hans.Marmo...-6LjvI5LOC4niH4Lt12DN6A@public.gmane.org> 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 > -3STc0vMhcl4RDUWM+popnw@public.gmane.org_references.build > -rnAAyyynLcbExEaVP8uzyqpC78sN+RKE@public.gmane.org > 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'' => > "#...@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-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Still same problem I try once more get :edit_in_place, {''attribute'' => {''name''=>''född''},''id'' => "#{@event.id}"} On 6 Juli, 12:53, Hans <Hans.Marmo...-6LjvI5LOC4niH4Lt12DN6A@public.gmane.org> wrote:> Problemn with the copying > The get :edit_in_place in the test should be > > get :edit_in_place, {''attribute'' => {''name''=>''född''},''id'' => > "#...@event.id}"} > > On 6 Juli, 12:44, Hans <Hans.Marmo...-6LjvI5LOC4niH4Lt12DN6A@public.gmane.org> 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 > > -3STc0vMhcl4RDUWM+popnw@public.gmane.org_references.build > > -rnAAyyynLcbExEaVP8uzyqpC78sN+RKE@public.gmane.org > > 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'' => > > "#...@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-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 <Hans.Marmo...-6LjvI5LOC4niH4Lt12DN6A@public.gmane.org> wrote:> Still same problem > I try once more > get :edit_in_place, > {''attribute'' => {''name''=>''född''},''id'' => "#...@event.id}"} > > On 6 Juli, 12:53, Hans <Hans.Marmo...-6LjvI5LOC4niH4Lt12DN6A@public.gmane.org> wrote: > > > > > > > > > Problemn with the copying > > The get :edit_in_place in the test should be > > > get :edit_in_place, {''attribute'' => {''name''=>''född''},''id'' => > > "#...@event.id}"} > > > On 6 Juli, 12:44, Hans <Hans.Marmo...-6LjvI5LOC4niH4Lt12DN6A@public.gmane.org> 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 > > > -3STc0vMhcl4RDUWM+popnw@public.gmane.org_references.build > > > -rnAAyyynLcbExEaVP8uzyqpC78sN+RKE@public.gmane.org > > > 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'' => > > > "#...@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-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.