Skip to content

Instantly share code, notes, and snippets.

@sbeam
Created August 25, 2011 20:55
Show Gist options
  • Select an option

  • Save sbeam/1171906 to your computer and use it in GitHub Desktop.

Select an option

Save sbeam/1171906 to your computer and use it in GitHub Desktop.
functional testing against authentication - example
class AbstractControllerTest < ActionController::TestCase
context "handle :index" do
context "logged as user"
setup do
logged_as(:user)
get :index
end
should_redirect_to("Root page"){root_path()}
end
context "logged as admin"
setup do
logged_as(:admin)
get :index
end
should_render_template :index
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment