当我在我的模型上运行 rspec 时,一切正常。我的控制器收到“堆栈级别太深”错误。
$> rspec spec/models
[DEPRECATED] The 'safe' write concern option has been deprecated in favor of 'w'.
............................................................
Finished in 1.28 seconds
60 examples, 0 failures
但是对于我的控制器,当我只添加 1 个示例时,我会收到此错误“堆栈级别太深”。
$> rspec spec/controllers
F
Failures:
1) GuestsController GET 'index' should render 200 page
Failure/Error: Unable to find matching line from backtrace
SystemStackError:
stack level too deep
# /Users/iyanski/.rvm/gems/ruby-1.9.3-p392@littleknot/gems/actionpack-3.2.13/lib/action_dispatch/routing/url_for.rb:102
Finished in 0.02816 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/controllers/guests_controller_spec.rb:5 # GuestsController GET 'index' should render 200 page
guest_controller_spec.rb
require 'spec_helper'
describe GuestsController do
describe "GET 'index'" do
it "should render 200 page" do
end
end
end
下面是我的 spec_helper.rb
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'factory_girl'
include Rails.application.routes.url_helpers
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
你认为这可能是什么原因造成的?