Add: #374 拡張ドメインブロックのインポート・エクスポートについてkmyblue独自の項目のサポート (#520)

* Fix: #374 拡張ドメインブロックのインポート・エクスポートについてkmyblue独自の項目が反映されない問題

* Fix test
This commit is contained in:
KMY(雪あすか) 2024-02-05 09:52:37 +09:00 committed by GitHub
parent 64a149b338
commit 4e1e675939
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 70 additions and 10 deletions

View file

@ -22,6 +22,7 @@ RSpec.describe Admin::ExportDomainBlocksController do
Fabricate(:domain_block, domain: 'bad.domain', severity: 'silence', public_comment: 'bad server')
Fabricate(:domain_block, domain: 'worse.domain', severity: 'suspend', reject_media: true, reject_reports: true, public_comment: 'worse server', obfuscate: true)
Fabricate(:domain_block, domain: 'reject.media', severity: 'noop', reject_media: true, public_comment: 'reject media and test unicode characters ♥')
Fabricate(:domain_block, domain: 'little.spam', severity: 'noop', public_comment: 'has some spams', reject_favourite: true, reject_reply: true, reject_straight_follow: true)
Fabricate(:domain_block, domain: 'no.op', severity: 'noop', public_comment: 'noop')
get :export, params: { format: :csv }
@ -43,7 +44,16 @@ RSpec.describe Admin::ExportDomainBlocksController do
end
it 'renders page with expected domain blocks' do
expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to contain_exactly(['bad.domain', :silence], ['worse.domain', :suspend], ['reject.media', :noop])
expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to contain_exactly(['bad.domain', :silence], ['worse.domain', :suspend], ['reject.media', :noop], ['little.spam', :noop])
end
it 'renders page with extended domain blocks' do
expect(assigns(:domain_blocks).map { |block| [block.domain, block.reject_favourite, block.reject_reply, block.reject_friend] }).to contain_exactly(
['bad.domain', false, false, false],
['worse.domain', false, false, false],
['reject.media', false, false, false],
['little.spam', true, true, false]
)
end
it 'returns http success' do