Skip to content

Instantly share code, notes, and snippets.

@rdavila
Created January 11, 2009 14:28
Show Gist options
  • Save rdavila/45709 to your computer and use it in GitHub Desktop.
Save rdavila/45709 to your computer and use it in GitHub Desktop.
class Test::Unit::TestCase
def self.should_require_login(*args)
args = Hash[*args]
login_url = args.delete :login_url
args.each do |action, verb|
should "Require login for '#{action}' action" do
send(verb, action)
assert_redirected_to(login_url)
end
end
end
end
should_require_login :new => :get, :edit => :get, :update => :put, :login_url => '/login'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment