mirror of
https://github.com/discourse/discourse.git
synced 2024-12-17 08:44:19 +08:00
ee1b90503c
https://meta.discourse.org/t/broken-image-in-discobot-certificate-with-no-logo-small-url/76594/2
38 lines
1000 B
Ruby
38 lines
1000 B
Ruby
require 'rails_helper'
|
|
|
|
describe "Discobot Certificate" do
|
|
let(:user) { Fabricate(:user, name: 'Jeff Atwood') }
|
|
|
|
describe 'when viewing the certificate' do
|
|
it 'should return the right text' do
|
|
params = {
|
|
date: Time.zone.now.strftime("%b %d %Y"),
|
|
user_id: user.id
|
|
}
|
|
|
|
stub_request(:get, /letter_avatar_proxy/).to_return(status: 200)
|
|
|
|
stub_request(:get, "http://test.localhost//images/d-logo-sketch-small.png")
|
|
.to_return(status: 200)
|
|
|
|
get '/discobot/certificate.svg', params: params
|
|
|
|
expect(response.status).to eq(200)
|
|
end
|
|
|
|
describe 'when params are missing' do
|
|
it "should raise the right errors" do
|
|
params = {
|
|
date: Time.zone.now.strftime("%b %d %Y"),
|
|
user_id: user.id
|
|
}
|
|
|
|
params.each do |key, _|
|
|
expect { get '/discobot/certificate.svg', params: params.except(key) }
|
|
.to raise_error(Discourse::InvalidParameters)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|