Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.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
Methods 未定义的方法“推断匿名控制器的基本类=';对于#<;RSpec::Core::配置:0x007f7fb3a62b80>;(命名者)_Methods_Undefined - Fatal编程技术网

Methods 未定义的方法“推断匿名控制器的基本类=';对于#<;RSpec::Core::配置:0x007f7fb3a62b80>;(命名者)

Methods 未定义的方法“推断匿名控制器的基本类=';对于#<;RSpec::Core::配置:0x007f7fb3a62b80>;(命名者),methods,undefined,Methods,Undefined,我现在正在读哈特尔教程的第7章,每次我跑步 bundle exec rspec规范/ 结果如下: /Users/siciliana/sample_app/spec/spec_helper.rb:31:in `block in <top (required)>': undefined method `infer_base_class_for_anonymous_controllers=' for #<RSpec::Core::Configuration:0x007f7fb3a62

我现在正在读哈特尔教程的第7章,每次我跑步

bundle exec rspec规范/

结果如下:

/Users/siciliana/sample_app/spec/spec_helper.rb:31:in `block in <top (required)>': undefined method `infer_base_class_for_anonymous_controllers=' for #<RSpec::Core::Configuration:0x007f7fb3a62b80> (NoMethodError)
        from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.6.4/lib/rspec/core.rb:79:in `configure'
        from /Users/siciliana/sample_app/spec/spec_helper.rb:11:in `<top (required)>'
        from /Users/siciliana/sample_app/spec/models/user_spec.rb:12:in `require'
        from /Users/siciliana/sample_app/spec/models/user_spec.rb:12:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load'
        from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files'
        from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
        from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
        from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
        from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
        from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
        from /usr/local/rvm/gems/ruby-2.0.0-p0/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `block in autorun'

我得到了同样的错误(尽管没有遵循教程)

我相信此设置需要
'rspec/rails'

我的解决办法是移动线路

config.infer_base_class_for_anonymous_controllers = # whatever

spec\u helper.rb
rails\u helper.rb

请显示上面添加的spec\u helper文件。感谢您的帮助!你最近升级过rspec吗?我刚升级到2.6,开始遇到同样的问题
config.infer_base_class_for_anonymous_controllers = # whatever