undefined_agents_spec.rb 549 B

123456789101112131415161718192021
  1. require 'capybara_helper'
  2. describe "handling undefined agents" do
  3. before do
  4. login_as(users(:bob))
  5. agent = agents(:bob_website_agent)
  6. agent.update_attribute(:type, 'Agents::UndefinedAgent')
  7. end
  8. it 'renders the error page' do
  9. visit agents_path
  10. expect(page).to have_text("Error: Agent(s) are 'missing in action'")
  11. expect(page).to have_text('Undefined Agent')
  12. end
  13. it 'deletes all undefined agents' do
  14. visit agents_path
  15. click_on('Delete Missing Agents')
  16. expect(page).to have_text('Your Agents')
  17. end
  18. end