小编tho*_*oux的帖子

Rails教程中的rspec错误:未定义的局部变量或方法`static_pages_index_path'

我followind Rails的教程,但有一个问题,第3.2.1节,就在图3.6.跑步时

$ bundle exec rspec spec/requests/static_pages_spec.rb
Run Code Online (Sandbox Code Playgroud)

我失败了

Failures:
  1) StaticPages GET /static_pages works! (now write some real specs)
     Failure/Error: get static_pages_index_path
     NameError:
       undefined local variable or method `static_pages_index_path' for # <RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fe7592b33b8>
     # ./spec/requests/static_pages_spec.rb:7:in `block (3 levels) in <top (required)>'    
Finished in 0.00454 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/requests/static_pages_spec.rb:5 # StaticPages GET /static_pages works! (now write some real specs)
Run Code Online (Sandbox Code Playgroud)

这是文件:

规格/请求/ static_pages_spec.rb

require 'spec_helper'
describe "Static pages" do
  describe "Home page" do
    it …
Run Code Online (Sandbox Code Playgroud)

rspec ruby-on-rails railstutorial.org

6
推荐指数
1
解决办法
4705
查看次数

标签 统计

railstutorial.org ×1

rspec ×1

ruby-on-rails ×1