مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
refactor: move lib/postal/smtp_server to app/lib/smtp_server
هذا الالتزام موجود في:
33
spec/lib/smtp_server/client/mail_from_spec.rb
Normal file
33
spec/lib/smtp_server/client/mail_from_spec.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
module SMTPServer
|
||||
|
||||
describe Client do
|
||||
let(:ip_address) { "1.2.3.4" }
|
||||
subject(:client) { described_class.new(ip_address) }
|
||||
|
||||
describe "MAIL FROM" do
|
||||
it "returns an error if no HELO is provided" do
|
||||
expect(client.handle("MAIL FROM: test@example.com")).to eq "503 EHLO/HELO first please"
|
||||
expect(client.state).to eq :welcome
|
||||
end
|
||||
|
||||
it "resets the transaction when called" do
|
||||
expect(client).to receive(:transaction_reset).and_call_original.at_least(3).times
|
||||
client.handle("HELO test.example.com")
|
||||
client.handle("MAIL FROM: test@example.com")
|
||||
client.handle("MAIL FROM: test2@example.com")
|
||||
end
|
||||
|
||||
it "sets the mail from address" do
|
||||
client.handle("HELO test.example.com")
|
||||
expect(client.handle("MAIL FROM: test@example.com")).to eq "250 OK"
|
||||
expect(client.state).to eq :mail_from_received
|
||||
expect(client.instance_variable_get("@mail_from")).to eq "test@example.com"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
المرجع في مشكلة جديدة
حظر مستخدم