mailing 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,9 +20,11 @@ module Mailing
20
20
  end
21
21
 
22
22
  def mail(builder=Mail)
23
- mail = builder.new(:from => @from, :subject => @subject, :body => @body)
23
+ mail = builder.new
24
+ mail.from @from
25
+ mail.subject = @subject
26
+ mail.body = @body
24
27
  mail.charset = 'UTF-8'
25
- mail.content_transfer_encoding = "8bit"
26
28
  mail
27
29
  end
28
30
  end
@@ -1,3 +1,3 @@
1
1
  module Mailing
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.4"
3
3
  end
@@ -27,7 +27,7 @@ class IntegrationTest < MiniTest::Unit::TestCase
27
27
  # send mailing
28
28
  t = Benchmark.realtime { mailing.send(sender) }
29
29
  assert t > 0.3
30
- assert t < 0.4
30
+ assert t < 0.45
31
31
 
32
32
  slog = log.string
33
33
  assert_match /from@domain.com/, slog
data/test/mailing_test.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'minitest/autorun'
2
3
  require 'mailing/mailing'
3
4
 
@@ -41,6 +42,15 @@ class MailingTest < MiniTest::Unit::TestCase
41
42
  assert_match /body/, mail
42
43
  end
43
44
 
45
+ def test_mail_with_encoding
46
+ mailing = Mailing::Mailing.new('Żółw <zolw@domain.com>', 'Żółć', 'korzyść')
47
+ mail = mailing.mail.encoded
48
+ assert_match 'charset=UTF-8', mail
49
+ assert_match 'From: =?UTF-8?B?xbvDs8WCdw==?= <zolw@domain.com>', mail
50
+ assert_match 'Subject: =?UTF-8?Q?=C5=BB=C3=B3=C5=82=C4=87?=', mail
51
+ assert_match 'a29yennFm8SH', mail
52
+ end
53
+
44
54
  def test_send
45
55
  sender = MiniTest::Mock.new
46
56
  sender.expect(:send, nil, [@mailing])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-13 00:00:00.000000000 Z
12
+ date: 2012-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail