Skip to content

Instantly share code, notes, and snippets.

@lmarburger
Created December 26, 2008 14:57
Show Gist options
  • Save lmarburger/40072 to your computer and use it in GitHub Desktop.
Save lmarburger/40072 to your computer and use it in GitHub Desktop.
require 'test_helper'
class PersonControllerTest < ActionController::TestCase
context "viewing a person" do
setup do
@session = { :person_id => @person_id = 1 }
@get_person = lambda { get :index, { :person_id => @person_id }, @session }
end
context "anonymously" do
setup do
@session = nil
@get_person.call
end
should_redirect_to 'new_session_path'
end
context "authenticated" do
setup { @get_person.call }
should_respond_with :success
should_render_template :show
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment