I'm following the rails tutorial here: http://railstutorial.org/chapters/filling-in-the-layout#top
When I run "rspec spec/", I get a bunch of errors that look like this:
1) LayoutLinks should have a Home page at '/'
Failure/Error: Unable to find matching line from backtrace
stack level too deep
# C:/Ruby19/lib/ruby/1.9.1/forwardable.rb:185
2) LayoutLinks should have a Contact page at '/contact'
Failure/Error: Unable to find matching line from backtrace
stack level too deep
# C:/Ruby19/lib/ruby/1.9.1/forwardable.rb:185
But when I go in my web browser to localhost:3000/ and localhost:3000/contact, the pages are there and the correct titles are there. Here is my myrailsroot\spec\requests\layout_links_spec.rb file:
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
it "should have a signup page at '/signup'" do
get '/signup'
response.should have_selector('title', :content => "Sign up")
end
end
Any ideas would be great, thanks
The following fixed the problem for me.
I was still seeing this issue until I specified webrat 0.7.1.
I am only seeing this issue for two of my title tests.
My gemfile is as follows...
I've tried the betas for rspec-rails as well, to no avail.
The two of the titles that are still giving me errors are the following:
From users_controller_spec.rc
The snippet from the errors reads:
and
respectively.
As seen by the output, "Sign Up" and "Index" are clearly shown to the right of the title. This is particularly perplexing in that, the following test does work:
Which is for the same page and contains the same title as the other "Sign Up" test. Also the get method works in this test but not in the "Index" test.
Help?
I GOT IT WORKING
W__A__Y__! more information than what you need, but for what it's worth, this Gemfile ...
... after I run ...
... and ...
... results in this ... bundle ...
... which got all of the sample application tests (through the end of Chapter 5) to run again.
I can confirm that the following Gemfile works correctly...