Vi sembra corretto questo test?

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs