edit_an_agent_spec.rb 533 B

123456789101112131415
  1. require 'rails_helper'
  2. describe "Editing an agent", js: true do
  3. it "creates an alert if a agent with invalid json is submitted" do
  4. login_as(users(:bob))
  5. visit("/agents/#{agents(:bob_website_agent).id}/edit")
  6. click_on("Toggle View")
  7. fill_in(:agent_options, with: '{
  8. "expected_receive_period_in_days": "2"
  9. "keep_event": "false"
  10. }')
  11. expect(get_alert_text_from { click_on "Save" }).to have_text("Sorry, there appears to be an error in your JSON input. Please fix it before continuing.")
  12. end
  13. end