opensmtpd_rails_frontend/test/models/credential_test.rb
Jez Caudle ae7846e46e Added tests for Credentials
Removed routes from credentials that aren't used along with controller actions
2024-05-14 14:54:32 +01:00

26 lines
576 B
Ruby

require "test_helper"
class CredentialTest < ActiveSupport::TestCase
test "email must be present" do
@c = Credential.new
assert_not @c.save
end
test "email must be valid" do
@c = Credential.new
@c.email = "not on your nelly"
assert_not @c.save
end
test "email must be unique" do
@c = Credential.new
@c.email = "bob@example.net"
assert_not @c.save
end
test "domain added to name" do
@c = Credential.new(email: "jez@#{domains(:one).domain}", password: "1234567&ab", domain_id: domains(:one).id)
assert @c.save
end
end