mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
Clean Topic#slug
when SiteSetting.slug_generation_method
changes.
https://meta.discourse.org/t/removing-the-concept-of-slugs-for-some-languages/26643/24?u=tgxworld
This commit is contained in:
parent
dee498a281
commit
d5293aeae2
2 changed files with 28 additions and 0 deletions
|
@ -201,6 +201,26 @@ describe Topic do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when updating SiteSetting.slug_generation_method' do
|
||||
let(:title) { '熱帶風暴畫眉熱帶風暴畫眉熱帶風暴畫眉' }
|
||||
let(:slug) { 'topic' }
|
||||
|
||||
it 'should clear the slug' do
|
||||
topic.save!
|
||||
expect(topic.title).to eq(title)
|
||||
expect(topic.slug).to eq(slug)
|
||||
|
||||
begin
|
||||
Scheduler::Defer.async = false
|
||||
SiteSetting.update(name: 'slug_generation_method', value: 'encoded')
|
||||
expect(topic.reload.read_attribute(:slug)).to eq(nil)
|
||||
ensure
|
||||
SiteSetting.where(name: 'slug_generation_method').destroy_all
|
||||
Scheduler::Defer.async = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "updating a title to be shorter" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue