Files
eminuxCRM/test/controllers/mail_identities_controller_test.rb
T
eminuxandCursor c4e5f289cf
CI / scan_ruby (push) Failing after 11m20s
CI / scan_js (push) Successful in 10m35s
CI / lint (push) Has been cancelled
Commit iniziale di eminuxCRM: CRM Rails con pipeline, campagne email e Docker.
Include autenticazione, progetti isolati, mail marketing HTML con SMTP, test A/B e editor WYSIWYG.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 23:01:48 +02:00

38 lines
1.1 KiB
Ruby

require "test_helper"
class MailIdentitiesControllerTest < ActionDispatch::IntegrationTest
test "non admin cannot manage smtp accounts" do
login_as users(:marco)
follow_redirect! if response.redirect?
get mail_identities_path
assert_redirected_to root_path
end
test "admin can create an smtp account" do
login_as users(:admin)
follow_redirect! if response.redirect?
assert_difference "MailIdentity.count", 1 do
post mail_identities_path, params: {
mail_identity: {
name: "MatchLiveTV",
from_name: "MatchLiveTV",
from_email: "hello@matchlivetv.test",
smtp_host: "smtp.test",
smtp_port: 587,
smtp_username: "hello@matchlivetv.test",
smtp_password: "super-secret",
smtp_authentication: "plain",
encryption: "starttls",
verify_ssl: "1",
active: "1"
}
}
end
assert_redirected_to mail_identities_path
identity = MailIdentity.find_by!(from_email: "hello@matchlivetv.test")
assert_equal "super-secret", identity.smtp_password
end
end