statuses_spec.rb 809 B

12345678910111213141516171819202122232425262728293031323334
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Admin::Statuses' do
  4. let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
  5. before do
  6. sign_in current_user
  7. end
  8. describe 'Performing batch updates' do
  9. before do
  10. _status = Fabricate(:status, account: current_user.account)
  11. visit admin_account_statuses_path(account_id: current_user.account_id)
  12. end
  13. context 'without selecting any records' do
  14. it 'displays a notice about selection' do
  15. click_on button_for_report
  16. expect(page).to have_content(selection_error_text)
  17. end
  18. end
  19. def button_for_report
  20. I18n.t('admin.statuses.batch.report')
  21. end
  22. def selection_error_text
  23. I18n.t('admin.statuses.no_status_selected')
  24. end
  25. end
  26. end