Method: ActiveRecordPermissionsTest#test_method_combinations_with_default_false

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

#test_method_combinations_with_default_falseObject



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/misc/active_record_permissions.rb', line 103

def test_method_combinations_with_default_false
  ActiveRecordPermissions.default_permission = false

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

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

  fail(@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