Created
July 3, 2012 18:57
-
-
Save rking/3041951 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe DeviseController do | |
it 'signs up Drivers correctly' do | |
visit '/drivers/sign_up' | |
p page.html | |
fill_in 'Email', with: '[email protected]' | |
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