Skip to content

Instantly share code, notes, and snippets.

@levent
Created May 26, 2010 10:52
Show Gist options
  • Select an option

  • Save levent/414340 to your computer and use it in GitHub Desktop.

Select an option

Save levent/414340 to your computer and use it in GitHub Desktop.
context "while not logged in" do
describe "index" do
%w(index show destroy update).each do |action|
it "should not allow access to #{action}" do
bypass_rescue
lambda {get action.to_sym}.should raise_exception(Acl9::AccessDenied)
end
end
end
end
SUPPORTED_FORMATS.each do |format|
it "should return current user if requested with allowed roles in #{format}" do
@user.roles_for(nil).should_not be_blank
get :show, :format => format, :id => @user.id
response.body.should =~ /allowed[_-]roles/
end
it "should return the requested user in #{format}" do
owned_user = @user.owned_users.make(:random, :owned_by_id => @user.id)
get :show, :format => format, :id => owned_user.id
send("expected_user_#{format}", owned_user)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment