I am following the code and what the pages say specifically, and the only thing I'm missing is the rspec gem for Ruby on Rails, as I was unable to get it (gives this error for rspec installation: "E: Unable to locate package rspec" so any help with that would be greatly appreciated) due to the inability to locate the package.
This is my entire pages_controller_spec.rb file, and the error displayed when the rails server tried to connect to the page is displayed in the title (if it's unable to be seen here it is again: "undefined method `describe' for PagesController:Class").
Note: I have also tried the code without "require 'spec_helper'" and it still will not operate.
class PagesController < ApplicationController
def home
end
def contact
end
def about
end
require 'spec_helper'
describe PagesController do
render_views
describe "GET 'home'" do
it "should be successful" do
get 'home'
response.should be_success
end
it "should have the right title" do
get 'home'
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App | Home")
end
end
describe "GET 'contact'" do
it "should be successful" do
get 'contact'
response.should be_success
end
it "should have the right title" do
get 'contact'
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App | Contact")
end
end
describe "GET 'about'" do
it "should be successful" do
get 'about'
response.should be_success
end
it "should have the right title" do
get 'about'
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App | About")
end
end
end
end
you need additional end
before spec helper require simply you are in the controller class and he is trying to call describe as method on controller. add it and it will be fine.
so it should be like this:
class PagesController < ApplicationController
def home
end
def contact
end
def about
end
end
and rest of file.