rails tutorial sample app

阅读第3章时,按照教程第一次运行rspec失败了:

E:\05 Create\Code\temp\railstutorial\sample_app>rspec spec/requests/static_pages
_spec.rb
E:/05 Create/Code/temp/railstutorial/sample_app/spec/spec_helper.rb:32:in `block
(2 levels) in <top (required)>': uninitialized constant Capybara (NameError)
        from D:/App/Coder/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rspe
c-core-3.5.4/lib/rspec/core/configuration.rb:758:in `expect_with'
        from E:/05 Create/Code/temp/railstutorial/sample_app/spec/spec_helper.rb
:23:in `block in <top (required)>'

这里找到了答案,而且不是网站的最佳答案。按评论的意思,应该又是哪个包的版本变化引起的。教程中要求在spec_helpr.rb中加入config.include Capybara::DSL,实际得加在rails_helper.rb对应位置才有效。

posted @ 2017-01-08 23:31  LustForLife  阅读(189)  评论(0编辑  收藏  举报