2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-21 19:29:35 -06:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe DiscourseNarrativeBot::CertificateGenerator do
|
|
|
|
let(:user) { Fabricate(:user) }
|
2019-10-21 11:14:15 -05:00
|
|
|
let(:avatar_url) { 'http://test.localhost/cdn/avatar.png' }
|
|
|
|
let(:date) { "2017-00-10" }
|
2017-12-21 19:29:35 -06:00
|
|
|
|
|
|
|
describe 'when an invalid date is given' do
|
|
|
|
it 'should default to the current date' do
|
2019-10-21 11:14:15 -05:00
|
|
|
expect { described_class.new(user, date, avatar_url) }.to_not raise_error
|
2017-12-21 19:29:35 -06:00
|
|
|
end
|
|
|
|
end
|
2017-12-21 19:30:24 -06:00
|
|
|
|
|
|
|
describe '#logo_group' do
|
2018-11-14 01:03:02 -06:00
|
|
|
describe 'when SiteSetting.site_logo_small_url is blank' do
|
2017-12-21 19:30:24 -06:00
|
|
|
before do
|
2018-11-14 01:03:02 -06:00
|
|
|
SiteSetting.logo_small = ''
|
2017-12-21 19:30:24 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not try to fetch a image' do
|
2019-10-21 11:14:15 -05:00
|
|
|
expect(described_class.new(user, date, avatar_url).send(:logo_group, 1, 1, 1))
|
2017-12-21 19:30:24 -06:00
|
|
|
.to eq(nil)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-12-21 19:29:35 -06:00
|
|
|
end
|