Skip to content

Commit 2715e59

Browse files
committed
Update tests that need the limit
1 parent ce7ffa7 commit 2715e59

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

spec/jobs/automatic_translation_backfill_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,23 @@ def expect_google_translate(text)
5959
end
6060

6161
it "does not backfill if backfill limit is set to 0" do
62+
SiteSetting.automatic_translation_backfill_maximum_translations_per_hour = 1
6263
SiteSetting.automatic_translation_target_languages = "de"
6364
SiteSetting.automatic_translation_backfill_maximum_translations_per_hour = 0
6465
expect_any_instance_of(Jobs::AutomaticTranslationBackfill).not_to receive(:process_batch)
6566
end
6667

6768
it "does not backfill if backfill lock is not secure" do
68-
SiteSetting.automatic_translation_target_languages = "de"
6969
SiteSetting.automatic_translation_backfill_maximum_translations_per_hour = 1
70+
SiteSetting.automatic_translation_target_languages = "de"
7071
Discourse.redis.set("discourse_translator_backfill_lock", "1")
7172
expect_any_instance_of(Jobs::AutomaticTranslationBackfill).not_to receive(:translate_records)
7273
end
7374

7475
describe "with two locales ['de', 'es']" do
7576
before do
76-
SiteSetting.automatic_translation_target_languages = "de|es"
7777
SiteSetting.automatic_translation_backfill_maximum_translations_per_hour = 100
78+
SiteSetting.automatic_translation_target_languages = "de|es"
7879
expect_google_check_language
7980
end
8081

@@ -107,8 +108,8 @@ def expect_google_translate(text)
107108

108109
describe "with just one locale ['de']" do
109110
before do
110-
SiteSetting.automatic_translation_target_languages = "de"
111111
SiteSetting.automatic_translation_backfill_maximum_translations_per_hour = 5 * 12
112+
SiteSetting.automatic_translation_target_languages = "de"
112113
expect_google_check_language
113114
end
114115

spec/jobs/translate_translatable_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
before do
99
SiteSetting.translator_enabled = true
1010
SiteSetting.translator_provider = "Google"
11+
SiteSetting.automatic_translation_backfill_maximum_translations_per_hour = 100
1112
SiteSetting.automatic_translation_target_languages = "es|fr"
1213
allow(DiscourseTranslator::Google).to receive(:translate)
1314
end

spec/models/post_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
fab!(:user)
140140

141141
it "enqueues translate_translatable job when post cooked" do
142+
SiteSetting.automatic_translation_backfill_maximum_translations_per_hour = 100
142143
SiteSetting.automatic_translation_target_languages = "es"
143144
post = Fabricate(:post, user: user)
144145
CookedPostProcessor.new(post).post_process
@@ -152,7 +153,8 @@
152153
)
153154
end
154155

155-
it "does not enqueues translate_translatable job for bot posts" do
156+
it "does not enqueue translate_translatable job for bot posts" do
157+
SiteSetting.automatic_translation_backfill_maximum_translations_per_hour = 1
156158
SiteSetting.automatic_translation_target_languages = "es"
157159
post = Fabricate(:post, user: Discourse.system_user)
158160
CookedPostProcessor.new(post).post_process

0 commit comments

Comments
 (0)