test: add initial tests for Postal::SMTPServer::Client

This commit is contained in:
Adam Cooke
2024-02-12 18:07:44 +00:00
parent ec636661d5
commit dece1d487a
19 changed files with 780 additions and 44 deletions
+9
View File
@@ -0,0 +1,9 @@
# frozen_string_literal: true
FactoryBot.define do
factory :credential do
server
name { "Example Credential" }
type { "API" }
end
end
+1 -1
View File
@@ -38,7 +38,7 @@
FactoryBot.define do
factory :domain do
association :owner, factory: :user
association :owner, factory: :organization
sequence(:name) { |n| "example#{n}.com" }
verification_method { "DNS" }
verified_at { Time.now }
+11
View File
@@ -0,0 +1,11 @@
# frozen_string_literal: true
FactoryBot.define do
factory :http_endpoint do
server
name { "HTTP endpoint" }
url { "https://example.com/endpoint" }
encoding { "BodyAsJSON" }
format { "Hash" }
end
end
+14
View File
@@ -0,0 +1,14 @@
# frozen_string_literal: true
FactoryBot.define do
factory :route do
name { "test" }
mode { "Accept" }
spam_mode { "Mark" }
before(:create) do |route|
route.server ||= create(:server)
route.domain ||= create(:domain, owner: route.server)
end
end
end
+4
View File
@@ -48,5 +48,9 @@ FactoryBot.define do
mode { "Live" }
provision_database { false }
sequence(:permalink) { |n| "server#{n}" }
trait :suspended do
suspended_at { Time.current }
end
end
end