Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.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
Rspec 添加';时堆栈级别太深(SystemStackError);规格帮助器&x27;_Rspec_Ruby On Rails 2 - Fatal编程技术网

Rspec 添加';时堆栈级别太深(SystemStackError);规格帮助器&x27;

Rspec 添加';时堆栈级别太深(SystemStackError);规格帮助器&x27;,rspec,ruby-on-rails-2,Rspec,Ruby On Rails 2,我正在升级一个旧的rails2.3应用程序,发现大多数规范都失败了。 我正在努力让他们通过 到目前为止,大多数规范文件还没有包含require“spec\u helper”,但需要添加它。 (不知道为什么它以前不在那里) 当我将spec\u helper添加到一些控制器时,我得到的错误堆栈级别太深(SystemStackError)。 我目前运行的程序如下,但我相信这可能是Rails 2.1的应用程序 轨道2.3.17 Rspec轨道1.3.2 Ruby 1.9.3 文件的顶部看起来像这样。

我正在升级一个旧的
rails2.3应用程序
,发现大多数规范都失败了。 我正在努力让他们通过

到目前为止,大多数规范文件还没有包含require
“spec\u helper”
,但需要添加它。 (不知道为什么它以前不在那里)

当我将
spec\u helper
添加到一些控制器时,我得到的错误堆栈级别太深
(SystemStackError)。

我目前运行的程序如下,但我相信这可能是Rails 2.1的应用程序

  • 轨道2.3.17
  • Rspec轨道1.3.2
  • Ruby 1.9.3
文件的顶部看起来像这样。 堆栈太深错误导致测试集根本无法实际运行。 如果我注释掉前三行,那么测试至少会运行,尽管所有测试都失败了

require 'spec_helper'
require 'active_merchant'
include ActiveMerchant::Billing

describe 'AccountsController' do
...
这是我在做了一点修改后能够得到的堆栈跟踪

2)
stack level too deep
../bin/ruby_noexec_wrapper:14:in `<main>'
../gems/activesupport-2.3.17/lib/active_support/dependencies.rb:170:in `load_with_new_constant_marking'
../gems/ruby-1.9.3-p392@project/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:15:in `block in load_files'
../rspec-1.3.2/lib/spec/runner/example_group_runner.rb:14:in `each'
../gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:14:in `load_files'
../gems/rspec-1.3.2/lib/spec/runner/options.rb:134:in `run_examples'
../gems/rspec-1.3.2/lib/spec/runner.rb:61:in `run'
../gems/rspec-1.3.2/lib/spec/runner.rb:45:in `block in autorun'
../gems/activesupport-2.3.17/lib/active_support/dependencies.rb:186: stack level too deep (SystemStackError)
2)
堆栈级别太深
../bin/ruby\u noexec\u包装器:14:in`'
../gems/activesupport-2.3.17/lib/active\u support/dependencies.rb:170:in'load\u with_new\u constant\u marking'
../gems/ruby-1.9.3-p392@project/gems/rspec-1.3.2/lib/spec/runner/example_group_runner.rb:15:in'block in load_files'
../rspec-1.3.2/lib/spec/runner/example\u group\u runner.rb:14:in'each'
../gems/rspec-1.3.2/lib/spec/runner/example\u group\u runner.rb:14:在“加载文件”中
../gems/rspec-1.3.2/lib/spec/runner/options.rb:134:in'run_examples'
../gems/rspec-1.3.2/lib/spec/runner.rb:61:in'run'
../gems/rspec-1.3.2/lib/spec/runner.rb:45:in'block in autorun'
../gems/activesupport-2.3.17/lib/active\u support/dependencies.rb:186:堆栈级别太深(SystemStackError)

从这里到哪里?

尝试将
包含ActiveMerchant::Billing
移动到描述块中,如下所示:

require 'spec_helper'
require 'active_merchant'

describe 'AccountsController' do
  include ActiveMerchant::Billing
  ...
参考资料:
  • Dave Chelimsky的博客文章标题为