1
0

software_update_policy_spec.rb 542 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe SoftwareUpdatePolicy do
  4. subject { described_class }
  5. let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Owner')).account }
  6. let(:john) { Fabricate(:account) }
  7. permissions :index? do
  8. context 'when owner' do
  9. it 'permits' do
  10. expect(subject).to permit(admin, SoftwareUpdate)
  11. end
  12. end
  13. context 'when not owner' do
  14. it 'denies' do
  15. expect(subject).to_not permit(john, SoftwareUpdate)
  16. end
  17. end
  18. end
  19. end