Missed a spot when redefining a method.

This commit is contained in:
Guo Xiang Tan 2017-05-26 13:00:17 +08:00
parent e57d2f5cb8
commit 144b810d0e
2 changed files with 19 additions and 2 deletions

View File

@ -3,6 +3,7 @@ module DiscourseNarrativeBot
def initialize(user, date)
@user = user
@date = I18n.l(Date.parse(date), format: :date_only)
@discobot_user = User.find(-2)
end
def new_user_track
@ -454,7 +455,7 @@ module DiscourseNarrativeBot
#{I18n.t('discourse_narrative_bot.new_user_narrative.cert_title')}
</text>
<text transform="translate(386.926 316.44)" font-size="18" fill="#020403" font-family="Tangerine, Tangerine">
#{NewUserNarrative.discobot_user.username}
#{@discobot_user.username}
</text>
<text transform="translate(98.126 317.35)" font-size="18" fill="#020403" font-family="Tangerine, Tangerine">
#{@date}
@ -532,7 +533,7 @@ module DiscourseNarrativeBot
<image clip-path="url(#clipCircle)" height="38px" width="38px" xlink:href="data:image/png;base64,#{Base64.strict_encode64(URI(avatar_url).open('rb', redirect: true, allow_redirections: :all).read)}"/>
</g>
<text transform="matrix(1.0705 0 0 1 544.2073 388.3629)" fill="#020403" font-family="'Tangerine'" font-size="24.9219px">
#{AdvancedUserNarrative.discobot_user.username}
#{@discobot_user.username}
</text>
<text x="#{width / 2}" y="270" text-anchor="middle" fill="#020403" font-family="'Tangerine'" font-size="34.8841px">
#{name}

View File

@ -4,6 +4,22 @@ 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)
xhr :get, '/discobot/certificate.svg', params
expect(response.status).to eq(200)
end
describe 'when params are missing' do
it "should raise the right errors" do
params = {