2012-04-23 48 views
1

在我的应用程序中,我正在测试创建一个新项目。目前我使用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 

我这样做对?最佳做法是什么?

回答

相关问题