Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在project manager应用程序中测试创建新项目的最佳方法_Ruby On Rails_Testing_Rspec_Integration Testing - Fatal编程技术网

Ruby on rails 在project manager应用程序中测试创建新项目的最佳方法

Ruby on rails 在project manager应用程序中测试创建新项目的最佳方法,ruby-on-rails,testing,rspec,integration-testing,Ruby On Rails,Testing,Rspec,Integration Testing,在我的应用程序中,我正在测试创建一个新项目。目前我使用rspec进行集成测试。这是我的密码: 3 describe "Projects" do 4 describe "create project" do 5 it "should create a new project" do 6 lambda do 7 visit root_path 8 click_link 'new project' 9

在我的应用程序中,我正在测试创建一个新项目。目前我使用rspec进行集成测试。这是我的密码:

  3 describe "Projects" do
  4   describe "create project" do
  5     it "should create a new project" do
  6       lambda do
  7         visit root_path
  8         click_link 'new project'        
  9         fill_in :name, :with => 'Project name'
 10         fill_in :description, :with => 'This is a description'
 11         click_button 'Create'
 12       end.should change(Project, :count).by(1)
 13     end
 14   end
 15 end
我还想在第11行之后添加如下内容:

response.should render_template 'new'
…但我一直在犯这个错误

@request must be an ActionDispatch::Request
我这样做对吗?最佳做法是什么

current_path.should == new_project_path
page.should have_selector('div#error_explanation')
据此,