闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
521 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. require 'pundit/rspec'
  4. RSpec.describe InstancePolicy do
  5. let(:subject) { described_class }
  6. let(:admin) { Fabricate(:user, admin: true).account }
  7. let(:john) { Fabricate(:user).account }
  8. permissions :index? do
  9. context 'admin' do
  10. it 'permits' do
  11. expect(subject).to permit(admin, Instance)
  12. end
  13. end
  14. context 'not admin' do
  15. it 'denies' do
  16. expect(subject).to_not permit(john, Instance)
  17. end
  18. end
  19. end
  20. end