I am following the Ruby on Rails tutorial here:
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=2.3
I am at this section:
http://ruby.railstutorial.org/chapters/filling-in-the-layout?version=2.3#code:layout_links_spec
Here is my layout_links_spec.rb:
require 'spec_helper'
describe "Layout links" do it "should have a Home page at '/'" do get '/' response.should render_template('pages/home') end
it "should have a Contact page at '/contact'" do get '/contact' response.should render_template('pages/contact') end
it "should have an About page at '/about'" do get '/about' response.should render_template('pages/about') end
it "should have a Help page at '/help'" do get '/help' response.should render_template('pages/help') end it "should have a signup page at '/signup'" do get '/signup' response.should render_template('users/new') end end
Here is my routes.rb:
ActionController::Routing::Routes.draw do |map| map.contact '/contact', :controller => 'pages', :action => 'contact' map.about '/about', :controller => 'pages', :action => 'about' map.help '/help', :controller => 'pages', :action => 'help' map.home '/', :controller => 'pages', :action => 'home' map.signup '/signup', :controller => 'users', :action => 'new' end
When I do a "spec spec/" I get 5 tests failed:
1) NoMethodError in 'Layout links should have a Home page at '/'' undefined method `match' for :Array /home/di/rails_projects/sample_app/spec/integration/layout_links_spec.rb:5:
2) NoMethodError in 'Layout links should have a Contact page at '/contact'' undefined method `match' for :Array /home/di/rails_projects/sample_app/spec/integration/layout_links_spec.rb:10:
3) NoMethodError in 'Layout links should have an About page at '/about'' undefined method `match' for :Array /home/di/rails_projects/sample_app/spec/integration/layout_links_spec.rb:15:
4) NoMethodError in 'Layout links should have a Help page at '/help'' undefined method `match' for :Array /home/di/rails_projects/sample_app/spec/integration/layout_links_spec.rb:20:
5) NoMethodError in 'Layout links should have a signup page at '/signup'' undefined method `match' for :Array /home/di/rails_projects/sample_app/spec/integration/layout_links_spec.rb:25:
All the links work in the web browser. I am using Ruby 1.8.7 and Rails 2.3.8. Why are my tests failing?
Thanks in advance for the help.