From 144b810d0e40f7d3a14901957fe2cd1822bd0161 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Fri, 26 May 2017 13:00:17 +0800 Subject: [PATCH] Missed a spot when redefining a method. --- .../certificate_generator.rb | 5 +++-- .../integration/discobot_certificate_spec.rb | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb index aed0874d2af..57bef91255f 100644 --- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb +++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb @@ -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')} - #{NewUserNarrative.discobot_user.username} + #{@discobot_user.username} #{@date} @@ -532,7 +533,7 @@ module DiscourseNarrativeBot - #{AdvancedUserNarrative.discobot_user.username} + #{@discobot_user.username} #{name} diff --git a/plugins/discourse-narrative-bot/spec/integration/discobot_certificate_spec.rb b/plugins/discourse-narrative-bot/spec/integration/discobot_certificate_spec.rb index 2cb9fec868b..394be887e68 100644 --- a/plugins/discourse-narrative-bot/spec/integration/discobot_certificate_spec.rb +++ b/plugins/discourse-narrative-bot/spec/integration/discobot_certificate_spec.rb @@ -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 = {