preview_card_spec.rb 573 B

123456789101112131415161718
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe PreviewCard do
  4. describe 'file size limit', :attachment_processing do
  5. it 'is set differently whether vips is enabled or not' do
  6. expect(described_class::LIMIT).to eq(Rails.configuration.x.use_vips ? 8.megabytes : 2.megabytes)
  7. end
  8. end
  9. describe 'Validations' do
  10. describe 'url' do
  11. it { is_expected.to allow_values('http://example.host/path', 'https://example.host/path').for(:url) }
  12. it { is_expected.to_not allow_value('javascript:alert()').for(:url) }
  13. end
  14. end
  15. end