1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-11-30 21:32:30 +00:00

a little more testing

هذا الالتزام موجود في:
Adam Cooke
2017-05-08 16:39:32 +01:00
الأصل 61e3bad83f
التزام eee01c9e15
10 ملفات معدلة مع 257 إضافات و4 حذوفات

عرض الملف

@@ -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