2
您好:這裏函,這就是我得到的shell:爲什麼功能測試失敗?運行rake測試時,
1) Failure:
test_should_create_client(ClientsControllerTest) [test/functional/clients_controller_test.rb:20]:
"Client.count" didn't change by 1.
<2> expected but was
<1>.
7 tests, 9 assertions, 1 failures, 0 errors
rake aborted!
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...]
,這就是我對在clients_controller_test.rb文件行20:
test "should create client" do
assert_difference('Client.count') do
post :create, :client => @client.attributes
end
請誰能告訴我問題來自哪裏?
非常感謝你nathanvda !!!!
我通過屬性測試,它works.Here」下面的代碼
test "should create client" do
assert_difference('Client.count') do
post :create, :client => {:name => 'jeff', :adress => 'ter', :city => 'ny',
:email =>'[email protected]', }
end
assert_redirected_to client_path(assigns(:client))
assert_equal 'Client was successfully created.', flash[:notice]
end
這裏是我耙後得到:測試:泛函:
Finished in 0.292246 seconds.
7 tests, 11 assertions, 0 failures, 0 errors
非常感謝 – blawzoo