File: white_list_test.rb

package info (click to toggle)
ruby-protected-attributes 1.0.8-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 304 kB
  • ctags: 382
  • sloc: ruby: 1,977; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 497 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'test_helper'
require 'active_model/mass_assignment_security'

class WhiteListTest < ActiveModel::TestCase

  def setup
    @white_list   = ActiveModel::MassAssignmentSecurity::WhiteList.new
    @included_key = 'first_name'
    @white_list  += [ @included_key ]
  end

  test "deny? is false for included items" do
    assert_equal false, @white_list.deny?(@included_key)
  end

  test "deny? is true for non-included items" do
    assert_equal true, @white_list.deny?('admin')
  end

end