Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

update for rspec 2.0 and bump gem version to 1.1

  • Loading branch information...
commit e5f5f1ea3ebac5e2db5ba7b45bdc2c5b9c4ea9ad 1 parent eb8c072
Ben Prew authored November 02, 2010
3  README.rdoc
Source Rendered
@@ -132,6 +132,9 @@ mailing list: ponyrb@googlegroups.com
132 132
 
133 133
 == Releases
134 134
 
  135
+1.1
  136
+* Add default options
  137
+
135 138
 1.0
136 139
 * Convert to using Mail as the mail-generation backend, instead of TMail
137 140
 
18  Rakefile
... ...
@@ -1,22 +1,8 @@
1 1
 require 'rake'
2  
-require 'spec/rake/spectask'
  2
+require 'rspec/core/rake_task'
3 3
 
4 4
 desc "Run all specs"
5  
-Spec::Rake::SpecTask.new('spec') do |t|
6  
-	t.spec_files = FileList['spec/*_spec.rb']
7  
-end
8  
-
9  
-desc "Print specdocs"
10  
-Spec::Rake::SpecTask.new(:doc) do |t|
11  
-	t.spec_opts = ["--format", "specdoc", "--dry-run"]
12  
-	t.spec_files = FileList['spec/*_spec.rb']
13  
-end
14  
-
15  
-desc "Run all examples with RCov"
16  
-Spec::Rake::SpecTask.new('rcov') do |t|
17  
-	t.spec_files = FileList['spec/*_spec.rb']
18  
-	t.rcov = true
19  
-	t.rcov_opts = ['--exclude', 'examples']
  5
+RSpec::Core::RakeTask.new() do |t|
20 6
 end
21 7
 
22 8
 task :default => :spec
16  lib/pony.rb
@@ -2,7 +2,7 @@
2 2
 require 'mail'
3 3
 require 'base64'
4 4
 
5  
-# = Pony, the express way to send email in Ruby
  5
+# = The express way to send email in Ruby
6 6
 # 
7 7
 # == Overview
8 8
 # 
@@ -90,13 +90,25 @@
90 90
 # Other options
91 91
 #  via # :smtp or :sendmail, see Transport section above
92 92
 #  via_options # specify transport options, see Transport section above
93  
-
  93
+#
  94
+# == Set default options 
  95
+# 
  96
+# Default options can be set so that they don't have to be repeated. The default options you set will be overriden by any options you pass in to Pony.mail()
  97
+# 
  98
+#   Pony.options = { :from => 'noreply@example.com', :via => :smtp, :via_options => { :host => 'smtp.yourserver.com' } }
  99
+#   Pony.mail(:to => 'foo@bar') # Sends mail to foo@bar from noreply@example.com using smtp 
  100
+#   Pony.mail(:from => 'pony@example.com', :to => 'foo@bar') # Sends mail to foo@bar from pony@example.com using smtp
94 101
 
95 102
 
96 103
 module Pony
97 104
 
98 105
 	@@options = {}
99 106
 
  107
+# Default options can be set so that they don't have to be repeated.
  108
+# 
  109
+#   Pony.options = { :from => 'noreply@example.com', :via => :smtp, :via_options => { :host => 'smtp.yourserver.com' } }
  110
+#   Pony.mail(:to => 'foo@bar') # Sends mail to foo@bar from noreply@example.com using smtp 
  111
+#   Pony.mail(:from => 'pony@example.com', :to => 'foo@bar') # Sends mail to foo@bar from pony@example.com using smtp
100 112
 	def self.options=(value)
101 113
 		@@options = value 
102 114
 	end
2  pony.gemspec
@@ -2,7 +2,7 @@
2 2
 
3 3
 Gem::Specification.new do |s|
4 4
 	s.name = %q{pony}
5  
-	s.version = "1.0"
  5
+	s.version = "1.1"
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
2  spec/base.rb
... ...
@@ -1,4 +1,4 @@
1 1
 require 'rubygems'
2  
-require 'spec'
  2
+require 'rspec'
3 3
 
4 4
 require File.dirname(__FILE__) + '/../lib/pony'
2  spec/pony_spec.rb
@@ -27,7 +27,7 @@
27 27
 
28 28
 	it "should handle depricated options gracefully" do
29 29
 		Pony.should_receive(:build_mail).with(hash_including(:via_options => {:address => 'test'}))
30  
-		Pony.mail(:to => 'foo@bar', :smtp => { :host => 'test' })
  30
+		Pony.mail(:to => 'foo@bar', :smtp => { :host => 'test' }, :via => :smtp)
31 31
 	end
32 32
 
33 33
 	it "should handle depricated content-type gracefully" do

0 notes on commit e5f5f1e

Please sign in to comment.
Something went wrong with that request. Please try again.