mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 12:58:06 +01:00
Add coverage for CSV responses for severed relationships (#31962)
This commit is contained in:
parent
66326065b0
commit
171394e914
1 changed files with 43 additions and 0 deletions
43
spec/requests/severed_relationships_spec.rb
Normal file
43
spec/requests/severed_relationships_spec.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Severed Relationships' do
|
||||
let(:account_rs_event) { Fabricate :account_relationship_severance_event }
|
||||
|
||||
before { sign_in Fabricate(:user) }
|
||||
|
||||
describe 'GET /severed_relationships/:id/following' do
|
||||
it 'returns a CSV file with correct data' do
|
||||
get following_severed_relationship_path(account_rs_event, format: :csv)
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('text/csv')
|
||||
expect(response.headers['Content-Disposition'])
|
||||
.to match(<<~FILENAME.squish)
|
||||
attachment; filename="following-example.com-#{Date.current}.csv"
|
||||
FILENAME
|
||||
expect(response.body)
|
||||
.to include('Account address')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET /severed_relationships/:id/followers' do
|
||||
it 'returns a CSV file with correct data' do
|
||||
get followers_severed_relationship_path(account_rs_event, format: :csv)
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('text/csv')
|
||||
expect(response.headers['Content-Disposition'])
|
||||
.to match(<<~FILENAME.squish)
|
||||
attachment; filename="followers-example.com-#{Date.current}.csv"
|
||||
FILENAME
|
||||
expect(response.body)
|
||||
.to include('Account address')
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue