DEV: Use `.sort!` instead of `.sort` for user archive specs (#11260)

This commit is contained in:
David Taylor 2020-11-17 12:29:47 +00:00 committed by GitHub
parent cac7ea35cf
commit bd7cdd19e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -331,7 +331,7 @@ describe Jobs::ExportUserArchive do
expect(data.find { |r| r['category_id'] == category.id }).to be_nil expect(data.find { |r| r['category_id'] == category.id }).to be_nil
expect(data.length).to eq(4) expect(data.length).to eq(4)
data.sort { |a, b| a['category_id'] <=> b['category_id'] } data.sort! { |a, b| a['category_id'] <=> b['category_id'] }
expect(data[0][:category_id]).to eq(subcategory.id.to_s) expect(data[0][:category_id]).to eq(subcategory.id.to_s)
expect(data[0][:notification_level].to_s).to eq('tracking') expect(data[0][:notification_level].to_s).to eq('tracking')
@ -358,7 +358,6 @@ describe Jobs::ExportUserArchive do
let(:admin) { Fabricate(:admin) } let(:admin) { Fabricate(:admin) }
it 'correctly exports queued posts' do it 'correctly exports queued posts' do
skip 'flaky'
SiteSetting.tagging_enabled = true SiteSetting.tagging_enabled = true
reviewable_post.perform(admin, :reject_post) reviewable_post.perform(admin, :reject_post)
@ -368,13 +367,13 @@ describe Jobs::ExportUserArchive do
data, csv_out = make_component_csv data, csv_out = make_component_csv
expect(data.length).to eq(2) expect(data.length).to eq(2)
data.sort { |e| e['id'].to_i } data.sort! { |e| e['id'].to_i }
expect(csv_out).to_not match(admin.username) expect(csv_out).to_not match(admin.username)
expect(data[0]['post_raw']).to eq('hello world post contents.') expect(data[0]['other_json']).to match('example_tag')
expect(data[0]['other_json']).to match('reply_to_post_number') expect(data[1]['post_raw']).to eq('hello world post contents.')
expect(data[1]['other_json']).to match('example_tag') expect(data[1]['other_json']).to match('reply_to_post_number')
end end
end end