当我在我的模型上运行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
但是对于我的控制器,当我添加一个例子时,我得到这个错误“堆栈级别太深”。
$> 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
guests_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
您认为这会导致什么?