43 lines
986 B
Ruby

require "test_helper"
class VirtualTest < ActiveSupport::TestCase
test "the email cant be blank" do
@v = Virtual.new
@v.destination = "davesmith@example.com"
assert !@v.save
end
test "the destination email cant be blank" do
@v = Virtual.new
@v.email = "davesmith@example.com"
assert !@v.save
end
test "the domain name of the email must be on this server" do
@v = Virtual.new
@v.email = "davesmith@notonthisserver.com"
@v.destination = "bob@example.net"
assert !@v.save
end
test "the email must be a valid email" do
@v = Virtual.new
@v.email = "something not quiet right"
assert !@v.save
end
test "the destination must be a valid email" do
@v = Virtual.new
@v.destination = "this will never work"
assert !@v.save
end
test "the email plus destination must be unique" do
@v = Virtual.new
@v.email = "abuse@example.net"
@v.destination ="bob@example.net"
assert !@v.save
end
end