Merge pull request #2835 from internetee/adding_test_coverage/admin/bounced_mail_addresses_controller

Adding test coverage for bounced_mail_addresses_controller
This commit is contained in:
Martin 2025-08-08 12:47:58 +03:00 committed by GitHub
commit c49cc357ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,31 @@
require 'test_helper'
class AdminAreaBouncedMailAddressesIntegrationTest < ApplicationIntegrationTest
setup do
@bounced_mail = bounced_mail_addresses(:one)
sign_in users(:admin)
end
def test_index_returns_success
get admin_bounced_mail_addresses_path
assert_response :success
assert_match @bounced_mail.email, response.body
end
def test_show_returns_success
get admin_bounced_mail_address_path(@bounced_mail)
assert_response :success
assert_match @bounced_mail.message_id, response.body
end
def test_destroy_deletes_bounced_mail_address
assert_difference('BouncedMailAddress.count', -1) do
delete admin_bounced_mail_address_path(@bounced_mail)
end
assert_redirected_to admin_bounced_mail_addresses_path
assert_raises(ActiveRecord::RecordNotFound) { @bounced_mail.reload }
end
end