mallet 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mallet (0.0.3)
4
+ mallet (0.0.5)
5
5
  actionmailer (~> 3.0)
6
6
  activerecord (~> 3.0)
7
7
  activesupport
@@ -5,6 +5,8 @@ require "delayed_job_active_record"
5
5
  require "mallet/version"
6
6
 
7
7
  module Mallet
8
+
9
+ DEFINITIONS = {}
8
10
 
9
11
  def self.table_name_prefix
10
12
  'mallet_'
@@ -24,6 +24,14 @@ module Mallet
24
24
  def persist!
25
25
  mail.save!
26
26
  end
27
+
28
+ def definition(name)
29
+ (DEFINITIONS[name] || {}).each do |key, value|
30
+ if respond_to?(key.to_sym)
31
+ send key.to_sym, value
32
+ end
33
+ end
34
+ end
27
35
 
28
36
  end
29
37
 
@@ -1,3 +1,3 @@
1
1
  module Mallet
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -39,6 +39,27 @@ describe Mallet::Mail do
39
39
 
40
40
  end
41
41
 
42
+ context "creating a mallet mail" do
43
+
44
+ it "should allow a definition to be specified" do
45
+ Mallet::DEFINITIONS['audit'] = {
46
+ 'mailer' => 'ActionMailer::Base',
47
+ 'method' => 'welcome'
48
+ }
49
+
50
+ job = @job
51
+
52
+ @mail = Mallet::mail do
53
+ to job
54
+ definition 'audit'
55
+ end
56
+
57
+ @mail.mailer_class.should == 'ActionMailer::Base'
58
+ @mail.mailer_method.should == 'welcome'
59
+ end
60
+
61
+ end
62
+
42
63
  context "on delivery" do
43
64
 
44
65
  before(:each) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mallet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-14 00:00:00.000000000 Z
13
+ date: 2013-03-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport