mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Error when an invalid date is passed to certificate generator.
https://meta.discourse.org/t/broken-image-in-discobot-certificate-with-no-logo-small-url/76594/2
This commit is contained in:
@@ -33,18 +33,5 @@ describe "Discobot Certificate" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when date is invalid' do
|
||||
it 'should raise the right error' do
|
||||
expect do
|
||||
get '/discobot/certificate.svg', params: {
|
||||
name: user.name,
|
||||
date: "<script type=\"text/javascript\">alert('This app is probably vulnerable to XSS attacks!');</script>",
|
||||
avatar_url: 'https://somesite.com/someavatar',
|
||||
user_id: user.id
|
||||
}
|
||||
end.to raise_error(ArgumentError, 'invalid date')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DiscourseNarrativeBot::CertificateGenerator do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
describe 'when an invalid date is given' do
|
||||
it 'should default to the current date' do
|
||||
expect { described_class.new(user, "2017-00-10") }.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user