Rspec 水豚点击按钮不';不要去创造行动

Rspec 水豚点击按钮不';不要去创造行动,rspec,capybara,Rspec,Capybara,我有一个定义如下的测试: it "should have allow you to fill out the new form and save a customer" do customer = Factory.build(:customer) visit new_customer_path factory_to_form "customer", customer, ["kf_code", "supported"] cli

我有一个定义如下的测试:

    it "should have allow you to fill out the new form and save a customer" do
        customer = Factory.build(:customer)
        visit new_customer_path
        factory_to_form "customer", customer, ["kf_code", "supported"]
        click_button "customer_submit"
        current_path.should eq(customer_path(Customer.last))
        page.should have_content "created customer"
        page.should have_content customer.long_name
    end
将customer设置为my customer factory,然后使用该工厂的数据(my factory_to_form宏所做的)填写新的操作表单,然后单击submit按钮,这是一个非常简单的操作

我的问题是提交按钮似乎从未触及创建操作,它将转到“/customers”,而不是保存客户

该表单是(@customer)的标准
表单,按钮只是
f.submit
,我想不出任何理由为什么该表单在浏览器中可以正常工作,但在本测试中却不能


为什么水豚不会发布到正确的位置?

是否涉及JavaScript?也许可以尝试使用像Webkit这样的驱动程序

setup do
  Capybara.javascript_driver = :webkit
  Capybara.current_driver = Capybara.javascript_driver
end