HuntersKeepers icon indicating copy to clipboard operation
HuntersKeepers copied to clipboard

Add Pundit/RSpec gem

Open ChaelCodes opened this issue 4 years ago • 1 comments

Describe the Feature

Is your feature request related to a problem? Please describe. Let's add pundit/rspec to make it easier to test policies and permissions. We'll only be using these helpers in test, so make sure they're in the test environment gem group.

We're having issues creating specs around helpers that are aware of permissions, like show_page_buttons. We're hoping that this gem allows us to do that.

Describe the Technical Implementation of the Solution

Solution

  • Add pundit/rspec to the test gem group
  • Try to create a spec for show_page_buttons.

References Varvet's guide to pundit/rspec

ChaelCodes avatar Jan 31 '21 17:01 ChaelCodes

I think we shouldn’t move pundit gem to the test group because it is used in the app not just in the testing. What do you want to do? We test the polices though spec/polices.

BTW, I think we must move all the methods in ApplicationPolicy to false unless all the index will be public.

https://github.com/ChaelCodes/HuntersKeepers/blob/main/app/policies/application_policy.rb#L13

JuanVqz avatar Feb 19 '21 05:02 JuanVqz