مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-11-30 21:32:30 +00:00
a little more testing
هذا الالتزام موجود في:
17
spec/lib/postal/message_db/database.rb
Normal file
17
spec/lib/postal/message_db/database.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe Postal::MessageDB::Database do
|
||||
|
||||
context "when provisioned" do
|
||||
subject(:database) { GLOBAL_SERVER.message_db }
|
||||
|
||||
it "should be a message db" do
|
||||
expect(database).to be_a Postal::MessageDB::Database
|
||||
end
|
||||
|
||||
it "should return the current schema version" do
|
||||
expect(database.schema_version).to be_a Integer
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,7 +1,27 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe Postal::MessageParser do
|
||||
it "should be true" do
|
||||
expect(Rails.env).to eq 'test'
|
||||
|
||||
it "should not do anything when there are no tracking domains" do
|
||||
with_global_server do |server|
|
||||
expect(server.track_domains.size).to eq 0
|
||||
message = create_plain_text_message(server, 'Hello world!', 'test@example.com')
|
||||
parser = Postal::MessageParser.new(message)
|
||||
expect(parser.actioned?).to be false
|
||||
expect(parser.tracked_links).to eq 0
|
||||
expect(parser.tracked_images).to eq 0
|
||||
end
|
||||
end
|
||||
|
||||
it "should replace links in messages" do
|
||||
with_global_server do |server|
|
||||
message = create_plain_text_message(server, 'Hello world! http://github.com/atech/postal', 'test@example.com')
|
||||
track_domain = create(:track_domain, :server => server, :domain => message.domain)
|
||||
parser = Postal::MessageParser.new(message)
|
||||
expect(parser.actioned?).to be true
|
||||
expect(parser.new_body).to match(/\AHello world! http:\/\/click\.#{message.domain.name}/)
|
||||
expect(parser.tracked_links).to eq 1
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم