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)>'
2) 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