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.