2013-10-03 32 views
0

这是一本关于着名的Rails Tutorial书的问题。我正在关注的tutorial高达第3章的问题来了,当我尝试在Listing 3.9Rails教程:测试代码

通过我的系统生成的代码生成测试代码:

require 'spec_helper' 

describe "StaticPages" do 
    describe "GET /static_pages" do 
    it "works! (now write some real specs)" do 
     # Run the generator again with the --webrat flag if you want to use webrat methods/matchers 
     get static_pages_index_path 
     response.status.should be(200) 
    end 
    end 
end 

正如你所看到的,它与Listing 3.9

生成的代码很不一样所以,有什么想法发生了什么?我是否应该使用清单3.9中的代码或代码继续该教程?

我使用Rails 4.0和Ruby 2.0,与本教程中作者的版本相同。

感谢您的帮助。

+0

通常情况下,您使用的是您的教程中的代码,因为您正在编写该教程,是不是?和'(现在写一些真正的规格)'恕我直言,恕不另行通知;) – pduersteler

回答

0

这只是您创建新集成测试文件时系统生成的示例代码。这是无关紧要的。

您可以将其删除,并随教程中的代码一起移动。

+0

谢谢你。你应得的观点:) – Zhaf