pony 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +10 -0
  2. data/lib/pony.rb +1 -1
  3. data/pony.gemspec +1 -1
  4. data/spec/pony_spec.rb +16 -6
  5. metadata +3 -3
@@ -71,6 +71,13 @@ Other options
71
71
  smtp # specify smtp info, see Transport section above
72
72
  tls # use tls, see TLS/SSL section above
73
73
 
74
+ == External Dependencies
75
+
76
+ tmail ~> 1.0
77
+ mime-types >= 1.16
78
+
79
+ Note: these requirements are specified in the gemspec as well. Also, you may need smtp_tls if you want to send via tls and are using ruby < 1.8.7
80
+
74
81
  == Meta
75
82
 
76
83
  Maintained by Ben Prew
@@ -88,6 +95,9 @@ mailing list: ponyrb@googlegroups.com
88
95
 
89
96
  == Releases
90
97
 
98
+ 0.7
99
+ * Pass :cc and :bcc options to sendmail appropriately
100
+
91
101
  0.6
92
102
  * Add :bcc capability
93
103
  * Add :charset capability
@@ -99,7 +99,7 @@ module Pony
99
99
  else
100
100
  smtp.start(o[:domain])
101
101
  end
102
- smtp.send_message tmail.to_s, tmail.from, tmail.to
102
+ smtp.send_message tmail.to_s, tmail.from, [ tmail.to, tmail.cc, tmail.bcc ].select { |i| i != '' }
103
103
  smtp.finish
104
104
  end
105
105
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{pony}
5
- s.version = "0.6"
5
+ s.version = "0.7"
6
6
 
7
7
  s.description = "Send email in one command: Pony.mail(:to => 'someone@example.com', :body => 'hello')"
8
8
  s.summary = s.description
@@ -121,36 +121,46 @@ Y29udGVudCBvZiBmb28ucGRm
121
121
  Net::SMTP.stub!(:new).and_return(@smtp)
122
122
  end
123
123
 
124
+ it "passes cc and bcc as the list of recipients" do
125
+ @smtp.should_receive(:send_message).with("message", 'from', ['to', 'cc', 'bcc'])
126
+ Pony.transport_via_smtp(mock('tmail', :to => 'to', :cc => 'cc', :from => 'from', :to_s => 'message', :bcc => 'bcc'))
127
+ end
128
+
129
+ it "only pass cc as the list of recipients" do
130
+ @smtp.should_receive(:send_message).with("message", 'from', ['to', 'cc' ])
131
+ Pony.transport_via_smtp(mock('tmail', :to => 'to', :cc => 'cc', :from => 'from', :to_s => 'message', :bcc => ''))
132
+ end
133
+
124
134
  it "defaults to localhost as the SMTP server" do
125
135
  Net::SMTP.should_receive(:new).with('localhost', '25').and_return(@smtp)
126
- Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message'))
136
+ Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message', :cc => '', :bcc => ''))
127
137
  end
128
138
 
129
139
  it "uses SMTP authorization when auth key is provided" do
130
140
  o = { :smtp => { :user => 'user', :password => 'password', :auth => 'plain'}}
131
141
  @smtp.should_receive(:start).with('localhost.localdomain', 'user', 'password', 'plain')
132
- Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message'), o)
142
+ Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message', :cc => '', :bcc => ''), o)
133
143
  end
134
144
 
135
145
  it "enable starttls when tls option is true" do
136
146
  o = { :smtp => { :user => 'user', :password => 'password', :auth => 'plain', :tls => true}}
137
147
  @smtp.should_receive(:enable_starttls)
138
- Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message'), o)
148
+ Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message', :cc => '', :bcc => ''), o)
139
149
  end
140
150
 
141
151
  it "starts the job" do
142
152
  @smtp.should_receive(:start)
143
- Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message'))
153
+ Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message', :cc => '', :bcc => ''))
144
154
  end
145
155
 
146
156
  it "sends a tmail message" do
147
157
  @smtp.should_receive(:send_message)
148
- Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message'))
158
+ Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message', :cc => '', :bcc => ''))
149
159
  end
150
160
 
151
161
  it "finishes the job" do
152
162
  @smtp.should_receive(:finish)
153
- Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message'))
163
+ Pony.transport_via_smtp(mock('tmail', :to => 'to', :from => 'from', :to_s => 'message', :cc => '', :bcc => ''))
154
164
  end
155
165
 
156
166
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pony
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.6"
4
+ version: "0.7"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Wiggins
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-01-03 00:00:00 -08:00
13
+ date: 2010-03-09 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -46,8 +46,8 @@ files:
46
46
  - Rakefile
47
47
  - pony.gemspec
48
48
  - lib/pony.rb
49
- - spec/base.rb
50
49
  - spec/pony_spec.rb
50
+ - spec/base.rb
51
51
  has_rdoc: true
52
52
  homepage: http://github.com/benprew/pony
53
53
  licenses: []