Skip to content

Instantly share code, notes, and snippets.

@rking
Created July 3, 2012 18:57
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 rking/3041951 to your computer and use it in GitHub Desktop.
Save rking/3041951 to your computer and use it in GitHub Desktop.
class DriversController < ApplicationController
before_filter :authenticate_driver!
def index
end
# GET /drivers/1/edit
def edit
@driver = Driver.find params[:id]
end
# PUT /drivers/1
# PUT /drivers/1.json
def update
@driver = Driver.find(params[:id])
respond_to do |format|
if @driver.update_attributes(params[:driver])
format.html { redirect_to @driver, notice: 'Driver was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @driver.errors, status: :unprocessable_entity }
end
end
end
end
Wwwipomo::Application.routes.draw do
devise_for :drivers
resources :drivers, only: [:edit, :update]
# authenticated :driver do
# root to: 'drivers/:id#edit'
# end
root to: 'home#index', as: 'home'
get "home/index"
end
require 'spec_helper'
describe DeviseController do
it 'signs up Drivers correctly' do
visit '/drivers/sign_up'
p page.html
fill_in 'Email', with: 'snoo@bloo.com'
fill_in 'Password', with: 'correct horse battery staple'
fill_in 'Password Confirmation', with: 'correct horse battery staple'
click_button 'Sign up'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment