export_summary_spec.rb 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe ExportSummary do
  4. subject { described_class.new(account) }
  5. let(:account) { Fabricate(:account) }
  6. let(:target_accounts) do
  7. [
  8. Fabricate(:account),
  9. Fabricate(:account, username: 'one', domain: 'local.host'),
  10. ]
  11. end
  12. describe '#total_storage' do
  13. it 'returns the total size of the media attachments' do
  14. media_attachment = Fabricate(:media_attachment, account: account)
  15. expect(subject.total_storage).to eq media_attachment.file_file_size || 0
  16. end
  17. end
  18. describe '#total_statuses' do
  19. before { Fabricate.times(2, :status, account: account) }
  20. it 'returns the total number of statuses' do
  21. expect(subject.total_statuses).to eq(2)
  22. end
  23. end
  24. describe '#total_bookmarks' do
  25. before { Fabricate.times(2, :bookmark, account: account) }
  26. it 'returns the total number of bookmarks' do
  27. expect(subject.total_bookmarks).to eq(2)
  28. end
  29. end
  30. describe '#total_follows' do
  31. before { target_accounts.each { |target_account| account.follow!(target_account) } }
  32. it 'returns the total number of the followed accounts' do
  33. expect(subject.total_follows).to eq(2)
  34. end
  35. end
  36. describe '#total_lists' do
  37. before { Fabricate.times(2, :list, account: account) }
  38. it 'returns the total number of lists' do
  39. expect(subject.total_lists).to eq(2)
  40. end
  41. end
  42. describe '#total_followers' do
  43. before { target_accounts.each { |target_account| target_account.follow!(account) } }
  44. it 'returns the total number of the follower accounts' do
  45. expect(subject.total_followers).to eq(2)
  46. end
  47. end
  48. describe '#total_blocks' do
  49. before { target_accounts.each { |target_account| account.block!(target_account) } }
  50. it 'returns the total number of the blocked accounts' do
  51. expect(subject.total_blocks).to eq(2)
  52. end
  53. end
  54. describe '#total_mutes' do
  55. before { target_accounts.each { |target_account| account.mute!(target_account) } }
  56. it 'returns the total number of the muted accounts' do
  57. expect(subject.total_mutes).to eq(2)
  58. end
  59. end
  60. describe '#total_domain_blocks' do
  61. before { Fabricate.times(2, :account_domain_block, account: account) }
  62. it 'returns the total number of account domain blocks' do
  63. expect(subject.total_domain_blocks).to eq(2)
  64. end
  65. end
  66. end