我的控制器操作执行以下操作:
我正在进行一些快速而肮脏的视图测试,只是在控制器测试中......对我来说不够强大,不想分离到视图测试中。
问题是我可以测试#1和#2,但不能测试#3。换句话说,这是我的测试代码:
describe "create - with valid, new data" do
it "creates a new signup" do
expect{
post :create, signup: FactoryGirl.attributes_for(:signup)
}.to change(Signup,:count).by(1)
end
it "redirect to form page" do
post :create, signup: FactoryGirl.attributes_for(:signup)
response.should render_template "subscribe/notification_email"
end
it "redirect to form page" do
post :create, signup: FactoryGirl.attributes_for(:signup)
response.should render_template "homepage"
end
end
前两个测试正在通过,最后一个测试失败。有没有办法告诉控制器测试转到下一个渲染的东西?或者我怎么测试呢?