Sha256: 7cca839209825e6594be9f352c233f2ab8759fb12f5340032f8bf175555acb2c
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
require_relative 'test_helper' class MailXSMTPAPI::FieldTest < Minitest::Test def test_encoded_with_blank_values assert_equal '', subject.new.encoded end def test_encoded_has_field_name f = subject.new({'to' => ['a@example.com', 'b@example.com']}) assert f.encoded.match(/^X-SMTPAPI: /), f.encoded end def test_encoded_has_spaces_in_json f = subject.new({'to' => ['a@example.com', 'b@example.com']}) assert f.encoded.include?('{"to": ["a@example.com", "b@example.com"]}') end def test_encoded_ends_with_crlf f = subject.new({'to' => ['a@example.com', 'b@example.com']}) assert f.encoded.match(/\r\n$/) end def test_encoded_is_folded f = subject.new('to' => 100.times.map{ 'test@example.com'} ) max_line_length = f.encoded.split(/[\r\n]+/).map(&:length).max assert max_line_length < 998, "max line length: #{max_line_length}" end def test_decoded h = {'to' => ['a@example.com', 'b@example.com']} assert_equal '{"to": ["a@example.com", "b@example.com"]}', subject.new(h).decoded end def test_empty? refute subject.new({'to' => ['a@example.com']}).empty? assert subject.new({'to' => []}).empty? end private def subject MailXSMTPAPI::Field end end
Version data entries
4 entries across 4 versions & 2 rubygems