在一个视图中,我有一个link_to
发布到 Commitments 控制器的助手:
<%= link_to "Engage in this project",
commitments_path( {participant_id: current_user.id, participated_project_id: p.id}),
method: :create %>
当我尝试运行以下集成测试时:
describe "participating in a project" do
let!(:project) {FactoryGirl.create(:project)}
before do
visit projects_path
click_on "Engage in this project"
end
it "should add that project to the users participated projects" do
user.participated_projects.should include(project)
end
end
......我得到了错误
NoMethodError:
undefined method `create' for #<Capybara::RackTest::Browser:0x007ffcc1072ce8>
该代码在手动测试中有效,但是我想使用 Capybara,任何想法=