[rspec-users] stack level too deep

Daniel Lidström dlidstrom at gmail.com
Fri Aug 27 16:12:27 EDT 2010


Hello,

I am trying to run my first integration tests of my rails 3
application. All tests fail with an error "stack level too deep". The
tests are intended to verify the link routes and look like this:

daniel at ubuntu/home/daniel/programming/rails_projects/sample_app$ cat
spec/requests/layout_links_spec.rb
require 'spec_helper'

describe "LayoutLinks" do

  it "should have a Home page at '/'" do
    get '/'
    response.should have_selector('title', :content => "Home")
  end

  it "should have a Contact page at '/contact'" do
    get '/contact'
    response.should have_selector('title', :content => "Contact")
  end

  it "should have an About page at '/about'" do
    get '/about'
    response.should have_selector('title', :content => "About")
  end

  it "should have a Help page at '/help'" do
    get '/help'
    response.should have_selector('title', :content => "Help")
  end

end


My routes.rb looks like this:

daniel at ubuntu/home/daniel/programming/rails_projects/sample_app$ cat
config/routes.rb
SampleApp::Application.routes.draw do
  get "pages/home"

  get "pages/contact"

  get "pages/about"

  get "pages/help"

  match '/about', :to => 'pages#about'

  match '/contact', :to => 'pages#contact'

  match '/help', :to => 'pages#help'

  match '/signup', :to => 'pages#signup'

  match '/signin', :to => 'pages#signin'
end

Now when I try to run the tests I get a stack level too deep error for
each one of them. Here's the output from "rspec -b spec/
requests" (last test included, others look the same):


4) LayoutLinks should have a Help page at '/help'
    Failure/Error: response.should have_selector('title', :content =>
"Help")
    stack level too deep
	.
	.
	.
	.
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/
adapters/rack.rb:26:in `response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/core/
methods.rb:29:in `response'
    # /usr/lib/ruby/gems/1.8/gems/rspec-rails-2.0.0.beta.19/lib/rspec/
rails/example/request_example_group.rb:34:in `last_response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/
adapters/rack.rb:26:in `response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/core/
methods.rb:29:in `response'
    # /usr/lib/ruby/gems/1.8/gems/rspec-rails-2.0.0.beta.19/lib/rspec/
rails/example/request_example_group.rb:34:in `last_response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/
adapters/rack.rb:26:in `response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/core/
methods.rb:29:in `response'
    # /usr/lib/ruby/gems/1.8/gems/rspec-rails-2.0.0.beta.19/lib/rspec/
rails/example/request_example_group.rb:34:in `last_response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/
adapters/rack.rb:26:in `response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/core/
methods.rb:29:in `response'
    # /usr/lib/ruby/gems/1.8/gems/rspec-rails-2.0.0.beta.19/lib/rspec/
rails/example/request_example_group.rb:34:in `last_response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/
adapters/rack.rb:26:in `response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/core/
methods.rb:29:in `response'
    # /usr/lib/ruby/gems/1.8/gems/rspec-rails-2.0.0.beta.19/lib/rspec/
rails/example/request_example_group.rb:34:in `last_response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/
adapters/rack.rb:26:in `response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/core/
methods.rb:29:in `response'
    # /usr/lib/ruby/gems/1.8/gems/rspec-rails-2.0.0.beta.19/lib/rspec/
rails/example/request_example_group.rb:34:in `last_response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/
adapters/rack.rb:26:in `response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/core/
methods.rb:29:in `response'
    # /usr/lib/ruby/gems/1.8/gems/rspec-rails-2.0.0.beta.19/lib/rspec/
rails/example/request_example_group.rb:34:in `last_response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/
adapters/rack.rb:26:in `response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/core/
methods.rb:29:in `response'
    # /usr/lib/ruby/gems/1.8/gems/rspec-rails-2.0.0.beta.19/lib/rspec/
rails/example/request_example_group.rb:34:in `last_response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/
adapters/rack.rb:26:in `response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/core/
methods.rb:29:in `response'
    # /usr/lib/ruby/gems/1.8/gems/rspec-rails-2.0.0.beta.19/lib/rspec/
rails/example/request_example_group.rb:34:in `last_response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/
adapters/rack.rb:26:in `response'
    # /usr/lib/ruby/gems/1.8/gems/webrat-0.7.2.beta.1/lib/webrat/core/
methods.rb:29:in `response'
    # ./spec/requests/layout_links_spec.rb:22
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example.rb:52:in `instance_eval'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example.rb:52
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example.rb:86:in `call'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example.rb:86:in `with_around_hooks'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example.rb:48
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example.rb:80:in `call'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example.rb:80:in `with_pending_capture'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example.rb:79:in `catch'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example.rb:79:in `with_pending_capture'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example.rb:47:in `run'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example_group.rb:222:in `run_examples'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example_group.rb:219:in `map'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example_group.rb:219:in `run_examples'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/example_group.rb:210:in `run'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/command_line.rb:42:in `run_examples'
    # /home/daniel/.gem/ruby/1.8/gems/activesupport-3.0.0.rc/lib/
active_support/dependencies.rb:219:in `inject'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/command_line.rb:42:in `each'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/command_line.rb:42:in `inject'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/command_line.rb:42:in `run_examples'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/command_line.rb:25:in `run'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/formatters/base_formatter.rb:37:in `report'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/formatters/base_formatter.rb:156:in `sync_output'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/formatters/base_formatter.rb:34:in `report'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/command_line.rb:22:in `run'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/runner.rb:46:in `run_in_process'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/runner.rb:37:in `run'
    # /usr/lib/ruby/gems/1.8/gems/rspec-core-2.0.0.beta.19/lib/rspec/
core/runner.rb:10
    # /usr/bin/rspec:19

daniel at ubuntu/home/daniel/programming/rails_projects/sample_app$


My Gemfile looks like this:


daniel at ubuntu/home/daniel/programming/rails_projects/sample_app$ cat
Gemfile
source 'http://rubygems.org'

gem 'rails', '3.0.0.rc'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3-ruby', :require => 'sqlite3'

group :development, :test do
  gem 'rspec-rails', '>= 2.0.0.beta.19'
end


Any ideas what is going on? I am using Ubuntu 10.04 x86_64.

Regards,

Daniel Lidström
Stockholm, Sweden


More information about the rspec-users mailing list