When writing tests using rspec, there is a nice helper called permissions that works similar to describe, but it does not support the :focus attribute used to limit which tests are run.
Example:
RSpec.describe SheetPolicy, type: :policy do
permissions :index? do
it 'grants access if the workbook is created by the user' do
expect(SheetPolicy).to permit(user, create(:sheet, workbook:))
end
end
permissions :show?, :focus do
it 'grants access if the workbook is created by the user' do
expect(SheetPolicy).to permit(user, create(:sheet, workbook:))
end
end
When you have config.filter_run_when_matching :focus in your spec_helper.rb file, it should only run the index block of tests, but from what I can tell, permissions does not support it.
When writing tests using rspec, there is a nice helper called
permissions
that works similar todescribe
, but it does not support the:focus
attribute used to limit which tests are run.Example:
When you have
config.filter_run_when_matching :focus
in yourspec_helper.rb
file, it should only run theindex
block of tests, but from what I can tell,permissions
does not support it.