Będzie kolejny spam.
Zaraz wychodzę z roboty ale zastanawiam mnie jedna rzecz.
Mianowicie jak mam spec kontrolera:
[code=ruby] describe “with invalid params” do
it “assigns a newly created but unsaved profile as @profile” do
# Trigger the behavior that occurs when invalid params are submitted
Profile.any_instance.stub(:save).and_return(false)
post :create, :profile => {}
assigns(:profile).should be_a_new(Profile)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Profile.any_instance.stub(:save).and_return(false)
post :create, :profile => {}
response.should render_template("new")
end
end
end[/code]
To czy nie lepiej by to było napisać
describe "with invalid params" do
it "assigns a newly created but unsaved profile as @profile and re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Profile.any_instance.stub(:save).and_return(false)
post :create, :profile => {}
assigns(:profile).should be_a_new(Profile)
response.should render_template("new")
end
end
end
Chodzi mi o wyrzucenie jednej asercji do drugiego IT’a.
A wy jak to robicie?