Skip to content

Instantly share code, notes, and snippets.

@panSarin
Created January 18, 2013 19:47
Show Gist options
  • Save panSarin/4567838 to your computer and use it in GitHub Desktop.
Save panSarin/4567838 to your computer and use it in GitHub Desktop.
require 'spec_helper'
require_relative 'controller_helper'
describe DocumentsController do
actions = rest_actions.reject{|a| a[:action] == :update}
actions << {method: :post, action: :mercury_save, params: {}}
actions << {method: :get, action: :upload, params: {}}
actions.each do |action|
{ admin: true, user: false, documents_manager: true}.each do |role, result|
it "#{role} should #{result ? '' : 'not'} have access to #{action[:method]} ##{action[:action]}" do
Document.stub(:find).and_return(Document.new) if action[:params].include?(:id)
check_privilages action, role, result
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment