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 lik
I am only seeing this issue for two of my title tests.
My gemfile is as follows...
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
gem 'gravatar_image_tag', '0.1.0'
gem 'will_paginate', '3.0.pre2'
group :development do
gem 'rspec-rails', '2.0.0.rc'
gem 'webrat', '0.7.1'
gem 'annotate-models', '1.0.4'
gem 'faker', '0.3.1'
end
group :test do
gem 'rspec', '2.0.0.rc'
gem 'webrat', '0.7.1'
gem 'spork', '0.8.4'
gem 'factory_girl_rails', '1.0'
end
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
it "should have the right title" do
get :index
response.should have_selector("title", :content => "All users")
end
#...
it "should have the right title" do
post :create, :user => @attr
response.should have_selector("title", :content => "Sign up")
end
The snippet from the errors reads:
Failures:
1) UsersController GET 'index' for signed-in users should have the right title
Failure/Error: response.should have_selector("title", :content => "All users")
expected following output to contain a All users tag:
Ruby on Rails Tutorial Sample App | All Users
and
2) UsersController Post 'create' for non-signed in users failure should have the right title
Failure/Error: response.should have_selector("title", :content => "Sign up")
expected following output to contain a Sign up tag:
Ruby on Rails Tutorial Sample App | Sign Up
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:
it "should have the right title" do
get :new
response.should have_selector("title", :content => "Sign up")
end
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?