follow_recommendation_policy_spec.rb 592 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe FollowRecommendationPolicy do
  4. let(:policy) { described_class }
  5. let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account }
  6. let(:john) { Fabricate(:account) }
  7. permissions :show?, :suppress?, :unsuppress? do
  8. context 'with an admin' do
  9. it 'permits' do
  10. expect(policy).to permit(admin, FollowRecommendation)
  11. end
  12. end
  13. context 'with a non-admin' do
  14. it 'denies' do
  15. expect(policy).to_not permit(john, FollowRecommendation)
  16. end
  17. end
  18. end
  19. end