Created
April 13, 2009 11:40
-
-
Save clemens/94405 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# UNTESTED! | |
# spec | |
it_should_require_admin_for_actions :new => :get, :create => :post, :edit => :get, :update => :put, :destroy => :delete | |
# macro | |
def it_should_require_admin_for_actions(actions={}) | |
actions.each do |action, method| | |
it "#{action} action (with method #{method}) should require admin" do | |
send(method, action, :id => 1) | |
response.should redirect_to(login_url) | |
flash[:error].should == "Unauthorized Access" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment