2023-10-23 03:50:02 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 01:12:25 -04:00
|
|
|
RSpec.describe PreviewCard do
|
2024-09-13 20:16:02 -04:00
|
|
|
describe 'file size limit', :attachment_processing do
|
|
|
|
it 'is set differently whether vips is enabled or not' do
|
|
|
|
expect(described_class::LIMIT).to eq(Rails.configuration.x.use_vips ? 8.megabytes : 2.megabytes)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-10-25 03:55:33 -04:00
|
|
|
describe 'Validations' do
|
|
|
|
describe 'url' do
|
|
|
|
it { is_expected.to allow_values('http://example.host/path', 'https://example.host/path').for(:url) }
|
|
|
|
it { is_expected.to_not allow_value('javascript:alert()').for(:url) }
|
2023-10-23 03:50:02 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|