mandrill_mailer 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -132,4 +132,7 @@ This would ensure that `course_url(course)` works as expected.
132
132
 
133
133
  The mailer and options passed to the `.test` method are yielded to the block.
134
134
 
135
- The `:email` option is the only required option, make sure to add at least this to your test object.
135
+ The `:email` option is the only required option, make sure to add at least this to your test object.
136
+
137
+ ## TODO
138
+ Either get rid of the mailchimp gem dependancy or hook into actionmailer like the mailchimp does to send normal emails.
@@ -61,6 +61,10 @@ module MandrillMailer
61
61
  # include Rails.application.routes.url_helpers
62
62
  include ActionView::Helpers::NumberHelper
63
63
 
64
+
65
+ class InvalidEmail < StandardError; end
66
+ class InvalidMailerMethod < StandardError; end
67
+
64
68
  # Public: Defaults for the mailer. Currently the only option is from:
65
69
  #
66
70
  # options - The Hash options used to refine the selection (default: {}):
@@ -114,13 +118,13 @@ module MandrillMailer
114
118
  # Returns the duplicated String.
115
119
  def self.test(mailer_method, options={})
116
120
  unless options[:email]
117
- raise Exception 'Please specify a :email option(email to send the test to)'
121
+ raise InvalidEmail.new 'Please specify a :email option(email to send the test to)'
118
122
  end
119
123
 
120
124
  if @@mailer_methods[mailer_method]
121
125
  @@mailer_methods[mailer_method].call(self.new, options)
122
126
  else
123
- raise Exception "The mailer method: #{mailer_method} does not have test setup"
127
+ raise InvalidMailerMethod.new "The mailer method: #{mailer_method} does not have test setup"
124
128
  end
125
129
 
126
130
  end
@@ -240,7 +244,8 @@ module MandrillMailer
240
244
  end
241
245
  end
242
246
  else
243
- Rails.application.routes.url_helpers.method(method).call(*args, host: MandrillMailer.config.default_url_options[:host])
247
+ options = args.extract_options!.merge({host: MandrillMailer.config.default_url_options[:host]})
248
+ Rails.application.routes.url_helpers.method(method).call(options)
244
249
  end
245
250
  end
246
251
 
@@ -1,3 +1,3 @@
1
1
  module MandrillMailer
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandrill_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
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-09-25 00:00:00.000000000 Z
12
+ date: 2012-09-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport