Rails 3 routing error

Here’s the error:

  1. SessionsController GET ‘new’ should be successful
    Failure/Error: get :new
    ActionController::RoutingError:
    No route matches {:controller=>“sessions”, :action=>“new”}

    ./spec/controllers/sessions_controller_spec.rb:8:in `block (3

levels) in <top (required)>’

  1. SessionsController GET ‘new’ should have the right title
    Failure/Error: get :new
    ActionController::RoutingError:
    No route matches {:controller=>“sessions”, :action=>“new”}

    ./spec/controllers/sessions_controller_spec.rb:13:in `block (3

levels) in <top (required)>’

Finished in 0.08406 seconds
2 examples, 2 failures

controllers/sessions_controller.rb:

class SessionsController < ApplicationController
def new
@title = “Sign in”
end

end

config/routes.rb:

SampleApp::Application.routes.draw do
#get “sessions/new”

resources :users
resources :sessions, :only => [:new, :create, :destory]
#get “users/new”

match ‘/signup’, :to => ‘users#new’
match ‘/signin’, :to => ‘sessions#new’
match ‘/signout’, :to => ‘sessions#destroy’

match ‘/about’, :to => ‘pages#about’
match ‘/contact’, :to => ‘pages#contact’
match ‘/help’, :to => ‘pages#help’

root :to => ‘pages#home’

get “pages/home”
get “pages/contact”
get “pages/about”
get “pages/help”

end

spec/controllers/sessions_controller_spec.rb:

require ‘spec_helper’

describe SessionsController do
render_views

describe “GET ‘new’” do
it “should be successful” do
get :new
response.should be_success
end

it "should have the right title" do
  get :new
  response.should have_selector('title', :content => "Sign in")
end

end

end

!@#!%$!@#$!@#$!@#$!@#$!@#$!@#$!@#$#!@#$!@#~!!!

If you are using spork to help minimize the time it takes to run tests,
you need to restart spork after making changes to the routes.rb file.
spork isn’t worth the hassle in my opinion.

On 28 July 2011 04:28, 7stud – [email protected] wrote:

[…]
resources :sessions, :only => [:new, :create, :destory]

Nothing to do with the problem, but that should be destroy, not destory

Colin