Created
January 15, 2010 09:45
-
-
Save fujimura/277930 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test::Unit::TestCase | |
def self.should_require_login(http_method, method) | |
should "require login wth #{http_method.to_s.upcase} :#{method}" do | |
raise "http verb(#{http_method} is not my cup of tea)" unless [:put, :get, :post, :delete].include? http_method.to_sym | |
if UserSession.find | |
UserSession.find.destroy | |
end | |
eval(http_method.to_s + "(\"#{method}\")") | |
assert_redirected_to new_user_session_path | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment