mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 14:43:38 +08:00
DEV: Improve specs for Validators::UploadValidator
.
This commit is contained in:
parent
d1684a1652
commit
575d6855ea
|
@ -29,5 +29,29 @@ describe Validators::UploadValidator do
|
|||
|
||||
expect(UploadCreator.new(csv_file, "#{filename}.gz", for_export: true).create_for(user.id)).to be_valid
|
||||
end
|
||||
|
||||
describe 'when allow_staff_to_upload_any_file_in_pm is true' do
|
||||
it 'should allow uploads for pm' do
|
||||
upload = Fabricate.build(:upload,
|
||||
user: Fabricate(:admin),
|
||||
original_filename: 'test.ico',
|
||||
for_private_message: true
|
||||
)
|
||||
|
||||
expect(subject.validate(upload)).to eq(true)
|
||||
end
|
||||
|
||||
describe 'for a normal user' do
|
||||
it 'should not allow uploads for pm' do
|
||||
upload = Fabricate.build(:upload,
|
||||
user: Fabricate(:user),
|
||||
original_filename: 'test.ico',
|
||||
for_private_message: true
|
||||
)
|
||||
|
||||
expect(subject.validate(upload)).to eq(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user