Method: ActiveRecordPermissionsTest#test_method_combinations_with_default_true

Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/test/misc/active_record_permissions.rb

#test_method_combinations_with_default_trueObject

Combinations Legend:

columns are: action method, column method, action/column method
symbols are: is (a)bsent, returns (f)alse, returns (t)rue, or n/a (_)


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/misc/active_record_permissions.rb', line 61

def test_method_combinations_with_default_true
  ActiveRecordPermissions.default_permission = true

  pass(@model.authorized_for?(:column => :a3), '_a_')
  fail(@model.authorized_for?(:column => :a2), '_f_')
  pass(@model.authorized_for?(:column => :a1), '_t_')

  pass(@model.authorized_for?(:action => :create), 'a__')
  fail(@model.authorized_for?(:action => :update), 'f__')
  pass(@model.authorized_for?(:action => :read), 't__')

  pass(@model.authorized_for?(:action => :create, :column => :c3), 'aaa')
  fail(@model.authorized_for?(:action => :create, :column => :b3), 'aaf')
  pass(@model.authorized_for?(:action => :create, :column => :a3), 'aat')
  fail(@model.authorized_for?(:action => :create, :column => :c2), 'afa')
  fail(@model.authorized_for?(:action => :create, :column => :b2), 'aff')
  fail(@model.authorized_for?(:action => :create, :column => :a2), 'aft')
  pass(@model.authorized_for?(:action => :create, :column => :c1), 'ata')
  fail(@model.authorized_for?(:action => :create, :column => :b1), 'atf')
  pass(@model.authorized_for?(:action => :create, :column => :a1), 'att')

  fail(@model.authorized_for?(:action => :update, :column => :c3), 'faa')
  fail(@model.authorized_for?(:action => :update, :column => :b3), 'faf')
  fail(@model.authorized_for?(:action => :update, :column => :a3), 'fat')
  fail(@model.authorized_for?(:action => :update, :column => :c2), 'ffa')
  fail(@model.authorized_for?(:action => :update, :column => :b2), 'fff')
  fail(@model.authorized_for?(:action => :update, :column => :a2), 'fft')
  fail(@model.authorized_for?(:action => :update, :column => :c1), 'fta')
  fail(@model.authorized_for?(:action => :update, :column => :b1), 'ftf')
  fail(@model.authorized_for?(:action => :update, :column => :a1), 'ftt')

  pass(@model.authorized_for?(:action => :read, :column => :c3), 'taa')
  fail(@model.authorized_for?(:action => :read, :column => :b3), 'taf')
  pass(@model.authorized_for?(:action => :read, :column => :a3), 'tat')
  fail(@model.authorized_for?(:action => :read, :column => :c2), 'tfa')
  fail(@model.authorized_for?(:action => :read, :column => :b2), 'tff')
  fail(@model.authorized_for?(:action => :read, :column => :a2), 'tft')
  pass(@model.authorized_for?(:action => :read, :column => :c1), 'tta')
  fail(@model.authorized_for?(:action => :read, :column => :b1), 'ttf')
  pass(@model.authorized_for?(:action => :read, :column => :a1), 'ttt')
end