severed_relationships_spec.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Severed Relationships' do
  4. let(:account_rs_event) { Fabricate :account_relationship_severance_event }
  5. before { sign_in Fabricate(:user) }
  6. describe 'GET /severed_relationships/:id/following' do
  7. it 'returns a CSV file with correct data' do
  8. get following_severed_relationship_path(account_rs_event, format: :csv)
  9. expect(response)
  10. .to have_http_status(200)
  11. expect(response.content_type)
  12. .to start_with('text/csv')
  13. expect(response.headers['Content-Disposition'])
  14. .to match(<<~FILENAME.squish)
  15. attachment; filename="following-example.com-#{Date.current}.csv"
  16. FILENAME
  17. expect(response.body)
  18. .to include('Account address')
  19. end
  20. end
  21. describe 'GET /severed_relationships/:id/followers' do
  22. it 'returns a CSV file with correct data' do
  23. get followers_severed_relationship_path(account_rs_event, format: :csv)
  24. expect(response)
  25. .to have_http_status(200)
  26. expect(response.content_type)
  27. .to start_with('text/csv')
  28. expect(response.headers['Content-Disposition'])
  29. .to match(<<~FILENAME.squish)
  30. attachment; filename="followers-example.com-#{Date.current}.csv"
  31. FILENAME
  32. expect(response.body)
  33. .to include('Account address')
  34. end
  35. end
  36. end