fix narrative bot spec to include base_uri key in translations

This commit is contained in:
Neil Lalonde 2018-09-21 12:37:35 -04:00
parent f8a77cd041
commit a530606da7
1 changed files with 12 additions and 4 deletions

View File

@ -4,6 +4,14 @@ describe User do
let(:user) { Fabricate(:user) }
let(:profile_page_url) { "#{Discourse.base_url}/users/#{user.username}" }
def i18n_post_args(extra = {})
{ base_uri: "" }.merge(extra)
end
def i18n_t(key, params = {})
I18n.t(key, i18n_post_args.merge(params))
end
before do
SiteSetting.queue_jobs = false
SiteSetting.discourse_narrative_bot_enabled = true
@ -15,7 +23,7 @@ describe User do
user
expected_raw = I18n.t('discourse_narrative_bot.new_user_narrative.hello.message',
expected_raw = i18n_t('discourse_narrative_bot.new_user_narrative.hello.message',
username: user.username, title: SiteSetting.title
)
@ -42,7 +50,7 @@ describe User do
it 'initiates the bot' do
expect { user }.to change { Topic.count }.by(1)
expect(Topic.last.title).to eq(I18n.t(
expect(Topic.last.title).to eq(i18n_t(
'discourse_narrative_bot.new_user_narrative.hello.title'
).gsub(/:robot:/, '').strip)
end
@ -56,7 +64,7 @@ describe User do
it 'initiate the bot' do
expect { user }.to change { Topic.count }.by(1)
expect(Topic.last.title).to eq(I18n.t(
expect(Topic.last.title).to eq(i18n_t(
'discourse_narrative_bot.new_user_narrative.hello.title'
))
end
@ -69,7 +77,7 @@ describe User do
it 'should send the right welcome message' do
expect { user }.to change { Topic.count }.by(1)
expect(Topic.last.title).to eq(I18n.t(
expect(Topic.last.title).to eq(i18n_t(
"system_messages.welcome_user.subject_template",
site_name: SiteSetting.title
))