# Vi sembra corretto questo test?

**URL:** <https://www.ruby-forum.com/t/vi-sembra-corretto-questo-test/207610>\
**Category:** IT\
**Created:** [May 30, 2011, 1:17am UTC](https://www.ruby-forum.com/t/vi-sembra-corretto-questo-test/207610 "2011-05-30T01:17:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [May 30, 2011, 1:17am UTC](https://www.ruby-forum.com/t/vi-sembra-corretto-questo-test/207610/1 "2011-05-30T01:17:44Z")

</div>

A me sembra di si:

it “re-renders the ‘new’ template” do  
Sector.any\_instance.stub(:save).and\_return(false)  
post :create, :sector =\> {}  
response.should render\_template(“new”)  
end

Pero’ mi dice:

SectorsController POST create with invalid params re-renders the ‘new’  
template  
Failure/Error: response.should render\_template(“new”)  
expecting \<“new”\> but rendering with \<""\>

Il controller e’:

class SectorsController \< InheritedResources::Base

def destroy  
destroy!(:notice =\> t(‘Sector’)+" deleted.")  
rescue  
flash[:error] = t(‘Sector’)+" is not deleted."  
end  
end

Uso inherited\_resources.

Se apro il browser e tento di creare un sector sbagliato mi viene  
fatto il render della new correttamente, quindi non capisco perche’ il  
test invece fallisce.
