Stack level too deep

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:

[email protected]/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:

[email protected]/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):

  1. 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:inresponse’
# /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:inresponse’
# /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:inlast_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:inresponse’
# /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:inresponse’
# /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:inlast_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:inresponse’
# /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:inresponse’
# /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:inlast_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:inresponse’
# /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:inresponse’
# /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:inlast_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:inresponse’
# /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:inresponse’
# /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:ininstance_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:inwith_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:inwith_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:inwith_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:inrun_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:inrun_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:inrun_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:ineach’
# /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:inrun_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:inreport’
# /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:inreport’
# /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:inrun_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

[email protected]/home/daniel/programming/rails_projects/sample_app$

My Gemfile looks like this:

[email protected]/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ömStockholm, Sweden

One thing I notice is you have “get ‘/’” yet you don’t have a root
route. You can define a root route like so:

root :to => “pages#home”

Also, you can run your requests by doing “rake spec:requests”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs