مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-11-30 21:32:30 +00:00
test: move Postal::RpecHelpers to spec/helpers
هذا الالتزام موجود في:
@@ -1,17 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Postal
|
|
||||||
module RspecHelpers
|
|
||||||
|
|
||||||
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
|
|
||||||
15
spec/helpers/general_helpers.rb
Normal file
15
spec/helpers/general_helpers.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module GeneralHelpers
|
||||||
|
|
||||||
|
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
|
||||||
@@ -32,7 +32,7 @@ RSpec.configure do |config|
|
|||||||
config.use_transactional_fixtures = true
|
config.use_transactional_fixtures = true
|
||||||
config.infer_spec_type_from_file_location!
|
config.infer_spec_type_from_file_location!
|
||||||
config.include FactoryBot::Syntax::Methods
|
config.include FactoryBot::Syntax::Methods
|
||||||
config.include Postal::RspecHelpers
|
config.include GeneralHelpers
|
||||||
|
|
||||||
config.before(:suite) do
|
config.before(:suite) do
|
||||||
# Test that the factories are working as they should and then clean up before getting started on
|
# Test that the factories are working as they should and then clean up before getting started on
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم