mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 23:20:44 +01:00
Add pending spec for User.those_who_can (#24724)
This commit is contained in:
parent
105f8687e4
commit
4cfe52635c
2 changed files with 23 additions and 2 deletions
|
@ -857,7 +857,6 @@ RSpec/PendingWithoutReason:
|
|||
Exclude:
|
||||
- 'spec/controllers/statuses_controller_spec.rb'
|
||||
- 'spec/models/account_spec.rb'
|
||||
- 'spec/models/user_spec.rb'
|
||||
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
|
||||
|
|
|
@ -527,6 +527,28 @@ RSpec.describe User, type: :model do
|
|||
end
|
||||
|
||||
describe '.those_who_can' do
|
||||
pending
|
||||
let!(:moderator_user) { Fabricate(:user, role: UserRole.find_by(name: 'Moderator')) }
|
||||
|
||||
context 'when there are not any user roles' do
|
||||
before { UserRole.destroy_all }
|
||||
|
||||
it 'returns an empty list' do
|
||||
expect(User.those_who_can(:manage_blocks)).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there are not users with the needed role' do
|
||||
it 'returns an empty list' do
|
||||
expect(User.those_who_can(:manage_blocks)).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there are users with roles' do
|
||||
let!(:admin_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
||||
it 'returns the users with the role' do
|
||||
expect(User.those_who_can(:manage_blocks)).to eq([admin_user])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue