tests coming along

This commit is contained in:
Jez Caudle 2023-05-10 21:03:21 +01:00
parent b652d54b8a
commit 2560fc36e7
6 changed files with 43 additions and 4 deletions

3
.gitignore vendored
View File

@ -4,6 +4,9 @@
# or operating system, you probably want to add a global ignore instead: # or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global' # git config --global core.excludesfile '~/.gitignore_global'
**/.keep
**/.core
# Ignore bundler config. # Ignore bundler config.
/.bundle /.bundle

View File

@ -1,2 +1,4 @@
class Virtual < ApplicationRecord class Virtual < ApplicationRecord
validates :email, presence: true
validates :destination, presence: true
end end

9
db/schema.rb generated
View File

@ -10,7 +10,14 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_05_10_141218) do ActiveRecord::Schema[7.0].define(version: 2023_05_10_184959) do
create_table "credentials", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.string "email"
t.string "password"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "domains", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| create_table "domains", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.string "domain" t.string "domain"
t.datetime "created_at", null: false t.datetime "created_at", null: false

BIN
test/fixtures/.credentials.yml.kate-swp vendored Normal file

Binary file not shown.

View File

@ -1,7 +1,34 @@
require "test_helper" require "test_helper"
class VirtualTest < ActiveSupport::TestCase class VirtualTest < ActiveSupport::TestCase
# test "the truth" do test "the email cant be blank" do
# assert true @v = Virtual.new
# end @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
# flunk()
end
test "the destination must be a valid email" do
# flunk()
end
test "the email plus destination must be unique" do
# flunk()
end
end end