为什么这行不通?
有人在说webrat
,Rails不应该直接处理表单注册吗?
下面的测试不会触发User#Create
动作,我想知道为什么。似乎什么都没有发生。
test "should not sign up more than 5 users" do
get "signup"
assert_response :success
assert_difference('User.count',5) do
for i in 0..10 do
puts "Signup user"
post_via_redirect "/signup",
:first_name => "Petter",
:last_name => "Smart",
:email => "petter.smart<%=i%>@prayalot.com",
:password => '123456',
:password_confirmation => '123456'
assert_equal '/sentmail', path
end
end
end