Я смотрю скриншот с урока 13 от Railstutorial.org и зациклен на приведенной ниже ошибке:
Failures:
1) PagesController GET 'home' when signed in should have the right follower/following counts
Failure/Error: response.should have_selector('a', :href => following_user_path(@user),
expected following output to contain a <a href='/users/1/following'>0 following</a> tag:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Ruby on Rails Tutorial Sample App | Home</title>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]--><link href="/assets/blueprint/screen.css" media="screen" rel="stylesheet" type="text/css">
<link href="/assets/blueprint/print.css" media="print" rel="stylesheet" type="text/css">
<!--[if lt IE 8]><link href="/assets/blueprint/ie.css" media="screen" rel="stylesheet" type="text/css" /><![endif]--><link href="/assets/custom.css" media="screen" rel="stylesheet" type="text/css">
<script src="/assets/defaults.js" type="text/javascript"></script>
</head>
<body>
<div class="container">
<header><a href="/"><img alt="Sample App" class="round" src="/assets/logo.png"></a>
<nav class="round"><ul>
<li> <a href="/">Home</a>
</li>
<li> <a href="/help">Help</a>
</li>
<li> <a href="/signin">Sign in</a>
</li>
</ul></nav></header><section class="round"><h1>Home</h1>
<p>Find me in app/views/pages/home.html.erb</p>
<a href="/signup" class="signup_button round">Sign up now!</a>
</section><footer><nav class="round"><ul>
<li> <a href="/about">About</a> </li>
<li> <a href="/contact">Contact</a> </li>
<li> <a href="http://news.railstutorial.org/">News</a> </li>
<li> <a href="http://railstutorial.org/">About</a> </li>
</ul></nav></footer>
</div>
</body>
</html>
# ./spec/controllers/pages_controller_spec.rb:119:in `block (4 levels) in <top (required)>'
Finished in 7.32 seconds
10 examples, 1 failure
Failed examples:
rspec ./spec/controllers/pages_controller_spec.rb:117 # PagesController GET 'home' when signed in should have the right follower/following counts
мой гемфайл:
source 'http://rubygems.org'
gem 'rack' , '1.3.3'
gem 'rails', '3.1.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'gravatar_image_tag', '1.0.0.pre2'
# gem 'will_paginate', '3.0.pre2'
gem 'will_paginate', '~> 3.0.2'
gem 'sqlite3', '1.3.4'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
group :development do
gem 'rspec-rails', '2.7.0'
# gem 'annotate-models', '1.0.4'
gem 'annotate', '2.4.0'
gem 'faker', '0.3.1'
end
group :test do
gem 'rspec-rails', '2.7.0'
gem 'webrat', '0.7.1'
gem 'spork', '0.9.0.rc8'
gem 'factory_girl_rails', '1.0'
# gem 'autotest', '4.4.6'
# gem 'autotest-rails-pure', '4.1.2'
# gem 'autotest-fsevent', '0.2.4'
# gem 'autotest-growl', '0.2.9'
end
Хотите знать, если это проблема версии rspec? -
pages_controller_spec.rb
it "should have the right follower/following counts" do
get :home
response.should have_selector('a', :href => following_user_path(@user),
:content => "0 following")
response.should have_selector('a', :href => followers_user_path(@user),
:content => "1 follower")
end
pages_controller.rb
class PagesController < ApplicationController
def home
@title = "Home"
if signed_in?
@micropost = Micropost.new
@feed_items = current_user.feed.paginate(:page => params[:page])
end
end
def contact
@title = "Contact"
end
def about
@title = "About"
end
def help
@title = "Help"
end
end
когда я комментирую раздел pages_controller_spec.rb, я становлюсь зеленым
Есть мысли?
Обновление 1:
Изменение версий RSPEC не сработало, пробовал 2.4.0, 2.6.1 и 2.6.4
Обновление 2:
Переход на Rails 3.1.0 не сработал
Обновление 3:
Triple Checked, запущенный rspec в оригинальном примере приложения Rails 3.0.8 ЗЕЛЕНЫЙ
обновление 4:
домашняя страница
<% if signed_in? %>
<table class="front" summary="For signed-in users">
<tr>
<td class="main">
<h1 class="micropost"> What's up? </h1>
<%= render 'shared/micropost_form' %>
<%= render 'shared/feed'%>
</td>
<td class="sidebar round">
<%= render 'shared/user_info' %>
<%= render 'shared/stats' %>
</td>
</tr>
</table>
<% else %>
<h1>Home</h1>
<p>Find me in app/views/pages/home.html.erb</p>
<%= link_to "Sign up now!", signup_path, :class => "signup_button round" %>
<% end %>