Hi. No joy with integrate_views either, although the error does change. I discovered that the old new and and edit templates still existed. So, with integrate_views and with the new.html.erb file on the filesystem, we get this.
'LocationsController handling POST /cms/locations with failed save should re-render 'new'' FAILED expected "locations/locations", got "/Users/mstuart2/Sites/cms/trunk/app/views/locations/new.html.erb" ./spec/controllers/locations_controller_spec.rb:333: With integrate_views, but deleting the new.html.erb file, we get this. TypeError in 'LocationsController handling POST /cms/locations with failed save should re-render 'new'' can't dup FalseClass Is this something I should report as well, or is this all known already? Thank you! On Tue, Aug 4, 2009 at 12:37 PM, David Chelimsky<dchelim...@gmail.com> wrote: > On Tue, Aug 4, 2009 at 11:32 AM, Michele Stuart<m...@half-deserted.net> wrote: >> Hi, all. >> >> I am perplexed. The problem I'm having seems to be related to >> rendering a "non-standard" view. In our controllers, the 'new' and >> 'edit' actions share a template, as shown here. >> >> Controller: >> >> def new >> �...@location = Location.new >> >> respond_to do |format| >> format.html { render :template => 'locations/locations' } >> format.xml { render :xml => @location } >> end >> end >> >> def edit >> �...@location = Location.find(params[:id]) >> render :template => 'locations/locations' >> end >> >> def create >> �...@location = Location.new(params[:location]) >> >> respond_to do |format| >> if @location.save >> flash[:notice] = 'Location was successfully created.' >> format.html { redirect_to(@location) } >> format.xml { render :xml => @location, :status => :created, >> :location => @location } >> else >> format.html { render :action => "new" } >> format.xml { render :xml => @location.errors, :status => >> :unprocessable_entity } >> end >> end >> end >> >> def update >> �...@location = Location.find(params[:id]) >> >> respond_to do |format| >> if @location.update_attributes(params[:location]) >> flash[:notice] = 'Location was successfully updated.' >> format.html { redirect_to(@location) } >> format.xml { head :ok } >> else >> format.html { render :action => "edit" } >> format.xml { render :xml => @location.errors, :status => >> :unprocessable_entity } >> end >> end >> end >> >> In the controller spec, the 'new' and 'edit' actions work fine, but >> when I try to get the response back for the 'update' and 'create' >> actions, I get a failure. >> >> This works: >> >> it "should render new template" do >> get :new >> response.should render_template('locations/locations') >> end >> >> This fails: >> >> describe "with failed save" do >> >> def do_post >> �...@location.should_receive(:save).and_return(false) >> post :create, :location => {} >> end >> >> it "should re-render 'new'" do >> do_post >> response.should render_template('locations/locations') >> end >> >> end >> >> >> Error: >> >> 'LocationsController handling POST /cms/locations with failed save >> should re-render 'new'' FAILED >> expected "locations/locations", got "locations/new" >> ./spec/controllers/locations_controller_spec.rb:320: >> >> >> >> Any advice is appreciated. Thank you. > > This is a bug. Please report it to http://rspec.lighthouseapp.com. > > You may be able to get this to pass in integration mode (add > integrate_views to the top of the example group), but I'm not sure > about that. > > Cheers, > David > >> >> - Michele >> _______________________________________________ >> rspec-users mailing list >> rspec-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users