skip_authorization_check not working in RSpec testing after an ActiveScaffold controller has been loaded

78 views
Skip to first unread message

Mike Blyth

unread,
Sep 4, 2012, 6:49:23 AM9/4/12
to actives...@googlegroups.com
This is a strange problem. I am using AS and CanCan and everything seems to be working OK. However, RSpec testing for a certain controller  C fails if an AS controller has been loaded before it. That failing test involves a controller which includes skip_authorization_check to bypass CanCan authorization.
  • If I run RSpec for C by itself, it works.
  • If I run tests for an AS controller (as_controller_spec) followed by C (c_controller_spec), C fails with CanCan authorization error
  • If I empty all the tests from the as_controller_spec, and empty all the content from as_controller, C passes
  • If I then include only "active_scaffold :group do |config|; end" in as_controller, as below, C fails again.
class GroupsController < ApplicationController
  active_scaffold :group do |config|; end
end
  • If I add a login to c_controller_spec, it works again.
So it appears that the skip_authorization_check is the piece that is not working. I don't know whether it has something to do with the CanCan bridge or something else.
Reply all
Reply to author
Forward
0 new messages