File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 3535 job . execute ( { } )
3636 end
3737
38+ it "detects most recently updated posts first" do
39+ post_2 = Fabricate ( :post , locale : nil )
40+ post_3 = Fabricate ( :post , locale : nil )
41+
42+ post . update! ( updated_at : 3 . days . ago )
43+ post_2 . update! ( updated_at : 2 . day . ago )
44+ post_3 . update! ( updated_at : 4 . day . ago )
45+
46+ original_batch = described_class ::BATCH_SIZE
47+ described_class . const_set ( :BATCH_SIZE , 1 )
48+
49+ DiscourseTranslator ::PostLocaleDetector . expects ( :detect_locale ) . with ( post_2 ) . once
50+ DiscourseTranslator ::PostLocaleDetector . expects ( :detect_locale ) . with ( post ) . never
51+ DiscourseTranslator ::PostLocaleDetector . expects ( :detect_locale ) . with ( post_3 ) . never
52+
53+ job . execute ( { } )
54+ ensure
55+ described_class . const_set ( :BATCH_SIZE , original_batch )
56+ end
57+
3858 it "skips bot posts" do
3959 post . update! ( user : Discourse . system_user )
4060 DiscourseTranslator ::PostLocaleDetector . expects ( :detect_locale ) . with ( post ) . never
You can’t perform that action at this time.
0 commit comments