RolifyCommunity/rolify — pull request #282 by zlotnika (2014-09-08 22:53:39+00:00)
Title: some failing tests to show that #has_role? does not re-check the state

The issue is this:

> When running `#has_role?` successively, with an `#add_role` or `#remove_role` in between, it can return the wrong answer.

This starts in commit b6e76b5817d428850ba9747a2a872c830aa17088, so I would say it is due to the usage of the global variable `@r_map`. It is important to note that this variable will not be overwritten even by a `#reload` of the user object.

I think the reason for this behavior has not created issues is that you generally only want to run `#has_role?` once per query - within which the `@r_map` is set. I still think this is bad since someone out there may accidentally call the method before and after a change in roles.