Ruby on rails 为什么功能测试失败?

Ruby on rails 为什么功能测试失败?,ruby-on-rails,testing,controller,Ruby On Rails,Testing,Controller,您好,运行rake测试时:functionals,下面是我在shell中得到的信息: 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

您好,运行rake测试时:functionals,下面是我在shell中得到的信息:

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/...]
有人能告诉我问题出在哪里吗?

非常感谢nathanvda

我已经将属性传递给了测试,它可以正常工作

  test "should create client" do
    assert_difference('Client.count') do
      post :create, :client => {:name => 'jeff', :adress => 'ter', :city => 'ny', 
                    :email =>'get@yahpp.fr', }
    end
    assert_redirected_to client_path(assigns(:client))
    assert_equal 'Client was successfully created.', flash[:notice]
  end
以下是我在rake:test:functionals之后得到的结果:


可能是由于传递给控制器的属性中存在验证错误,因此未创建新客户端。

可能是由于传递给控制器的属性中存在验证错误,因此未创建新客户端

  test "should create client" do
    assert_difference('Client.count') do
      post :create, :client => {:name => 'jeff', :adress => 'ter', :city => 'ny', 
                    :email =>'get@yahpp.fr', }
    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