1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/spec/policies/report_policy_spec.rb
Eugen Rochko 44b2ee3485
Add customizable user roles (#18641)
* Add customizable user roles

* Various fixes and improvements

* Add migration for old settings and fix tootctl role management
2022-07-05 02:41:40 +02:00

24 lines
553 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
require 'pundit/rspec'
RSpec.describe ReportPolicy do
let(:subject) { described_class }
let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account }
let(:john) { Fabricate(:account) }
permissions :update?, :index?, :show? do
context 'staff?' do
it 'permits' do
expect(subject).to permit(admin, Report)
end
end
context '!staff?' do
it 'denies' do
expect(subject).to_not permit(john, Report)
end
end
end
end