1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activemodel/test/cases/mass_assignment_security/permission_set_test.rb
Josh Kalderimis 4b66aab00f mass_assignment_security moved from AR to AMo, and minor test cleanup
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-08 18:28:45 +02:00

30 lines
882 B
Ruby

require "cases/helper"
class PermissionSetTest < ActiveModel::TestCase
def setup
@permission_list = ActiveModel::MassAssignmentSecurity::PermissionSet.new
end
test "+ stringifies added collection values" do
symbol_collection = [ :admin ]
new_list = @permission_list += symbol_collection
assert new_list.include?('admin'), "did not add collection to #{@permission_list.inspect}}"
end
test "include? normalizes multi-parameter keys" do
multi_param_key = 'admin(1)'
new_list = @permission_list += [ 'admin' ]
assert new_list.include?(multi_param_key), "#{multi_param_key} not found in #{@permission_list.inspect}"
end
test "include? normal keys" do
normal_key = 'admin'
new_list = @permission_list += [ normal_key ]
assert new_list.include?(normal_key), "#{normal_key} not found in #{@permission_list.inspect}"
end
end