a little more testing

This commit is contained in:
Adam Cooke
2017-05-08 16:39:32 +01:00
parent 61e3bad83f
commit eee01c9e15
10 changed files with 257 additions and 4 deletions
+22
View File
@@ -0,0 +1,22 @@
module Postal
module RspecHelpers
def with_global_server(&block)
server = Server.find(GLOBAL_SERVER.id)
block.call(server)
ensure
server.message_db.provisioner.clean
end
def create_plain_text_message(server, text, to = 'test@example.com', override_attributes = {})
domain = create(:domain, :owner => server)
attributes = {:from => "test@#{domain.name}", :subject => "Test Plain Text Message"}.merge(override_attributes)
attributes[:to] = to
attributes[:plain_body] = text
message = OutgoingMessagePrototype.new(server, '127.0.0.1', 'testsuite', attributes)
result = message.create_message(to)
server.message_db.message(result[:id])
end
end
end