Files
opensmtpd_rails_frontend/test/models/credential_test.rb

31 lines
792 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(:domainone).domain}", password: "1234567&ab", domain_id: domains(:domainone).id)
assert @c.save
end
test "domain_id not the same as domain" do
@c = Credential.new(email: "steve@#{domains(:domainone).domain}", password: "1234567&ab", domain_id: domains(:domainone).id)
assert_not @c.save
end
end