Skip to content

Instantly share code, notes, and snippets.

@ceaser
Created February 2, 2012 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ceaser/1726445 to your computer and use it in GitHub Desktop.
Save ceaser/1726445 to your computer and use it in GitHub Desktop.
Overriding Controllers with Devise
# Located at app/controllers/people/registrations_controller_spec.rb
class People::RegistrationsController < Devise::RegistrationsController
end
# Located at spec/controllers/people/registrations_controller_spec.rb
require 'spec_helper'
describe People::RegistrationsController do
describe "POST 'create'" do
it "creates an person" do
post :create
end
it "creates a site"
it "flashes a notice on successful signup"
it "should sign in"
it "should redirect to the 'Home#index'"
end
describe "POST 'create' with invalid parameters" do
it "flashes an invalid message"
it "expires session data"
it "renders 'new'"
end
end
# Located at config/routes.rb
MyApp::Application.routes.draw do
devise_for :people, :controllers => { sessions: "people/sessions", registrations: "people/registrations"}
# ...
match '/person/sites' => 'sites#index', as: "person_root"
root :to => 'home#index'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment