Skip to content

Instantly share code, notes, and snippets.

@robwilliams
Forked from rdavila/gist:45709
Created May 19, 2009 21:05
Show Gist options
  • Save robwilliams/114403 to your computer and use it in GitHub Desktop.
Save robwilliams/114403 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