Skip to content

Instantly share code, notes, and snippets.

@rking
Created July 9, 2012 03:26
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/3074065 to your computer and use it in GitHub Desktop.
Save rking/3074065 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe DriversController do
before :each do
@driver = FactoryGirl.create :driver
@another_driver = FactoryGirl.create :another_driver
end
describe 'GET edit' do
it 'assigns the requested driver as @driver' do
sign_in @driver
get :edit, id: @driver.id
assigns(:driver).should eq(@driver)
end
it "blocks attempts to edit others' data" do
sign_in @driver
get :edit, id: @another_driver.id
response.should redirect_to(edit_driver_path(@driver))
end
it 'redirects after sign_in' do
sign_in @driver
response.should redirect_to(edit_driver_registration_path)
end
end
end
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment