exports_spec.rb 872 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Export page' do
  4. let(:user) { Fabricate :user }
  5. before { sign_in user }
  6. describe 'Viewing the export page' do
  7. context 'when signed in' do
  8. it 'shows the export page', :aggregate_failures do
  9. visit settings_export_path
  10. expect(page)
  11. .to have_content(takeout_summary)
  12. .and have_private_cache_control
  13. end
  14. end
  15. end
  16. describe 'Creating a new archive' do
  17. it 'queues a worker and redirects' do
  18. visit settings_export_path
  19. expect { request_archive }
  20. .to change(BackupWorker.jobs, :size).by(1)
  21. expect(page)
  22. .to have_content(takeout_summary)
  23. end
  24. def request_archive
  25. click_on I18n.t('exports.archive_takeout.request')
  26. end
  27. end
  28. def takeout_summary
  29. I18n.t('settings.export')
  30. end
  31. end