saucy 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ 0.7.0
2
+
3
+ Split Saucy::Configuration.mailer_sender into support_email_address and manager_email_address.
4
+
1
5
  0.6.1
2
6
 
3
7
  Fix for this known bug in Rails 3.0.7
data/README.md CHANGED
@@ -27,15 +27,21 @@ After you bundle, run the generator:
27
27
 
28
28
  You will want to include the `ensure_active_account` `before_filter` in any controller actions that you want to protect if the user is using an past due paid account.
29
29
 
30
- You will want to customize the from email address on billing and invite emails:
30
+ You will want to customize the from email addresses.
31
31
 
32
- Saucy::Configuration.mailer_sender = "billingemail@example.com"
32
+ Support email address for your application:
33
+
34
+ Saucy::Configuration.support_email_address = "support@example.com"
35
+
36
+ Personalizable emails such as trial expiration notice and activation encouragement are sent from a product manager personal address:
37
+
38
+ Saucy::Configuration.manager_email_address = "manager@example.com"
33
39
 
34
40
  If you have an account with Braintree with multiple merchant accounts you'll want to configure the merchant account for this application:
35
41
 
36
42
  Saucy::Configuration.merchant_account_id = 'your merchant account id'
37
43
 
38
- In addition, there are a number of strings such as application name, support url, etc. that are provided and customized with i18n translations. You can customize these in your app, and you can see what they are by looking at config/locales/en.yml in saucy.
44
+ In addition, there are a number of strings such as application name, support url, automated emails, etc. that are provided and customized with i18n translations. You can customize these in your app, and you can see what they are by looking at config/locales/en.yml in saucy.
39
45
 
40
46
  There is a `saucy:daily` rake task which should be run on a regular basis to send receipts and payment processing problem emails.
41
47
 
@@ -6,7 +6,8 @@ class BillingMailer < ActionMailer::Base
6
6
  :subject => I18n.t(:subject,
7
7
  :scope => [:saucy, :mailers, :billing_mailer, :receipt],
8
8
  :default => "Subscription receipt"),
9
- :from => Saucy::Configuration.mailer_sender)
9
+ :reply_to => Saucy::Configuration.support_email_address,
10
+ :from => Saucy::Configuration.support_email_address)
10
11
  end
11
12
 
12
13
  def problem(account, transaction)
@@ -15,25 +16,28 @@ class BillingMailer < ActionMailer::Base
15
16
  :subject => I18n.t(:subject,
16
17
  :scope => [:saucy, :mailers, :billing_mailer, :problem],
17
18
  :default => "Problem with subscription billing"),
18
- :from => Saucy::Configuration.mailer_sender)
19
+ :reply_to => Saucy::Configuration.support_email_address,
20
+ :from => Saucy::Configuration.support_email_address)
19
21
  end
20
22
 
21
23
  def expiring_trial(account)
22
24
  @account = account
23
- mail(:to => account.admin_emails,
24
- :subject => I18n.t(:subject,
25
+ mail(:to => account.admin_emails,
26
+ :subject => I18n.t(:subject,
25
27
  :scope => [:billing_mailer, :expiring_trial],
26
28
  :default => "Your trial is expiring soon"),
27
- :from => Saucy::Configuration.mailer_sender)
29
+ :reply_to => Saucy::Configuration.support_email_address,
30
+ :from => Saucy::Configuration.manager_email_address)
28
31
  end
29
32
 
30
33
  def new_unactivated(account)
31
34
  @account = account
32
- mail(:to => account.admin_emails,
33
- :subject => I18n.t(:subject,
35
+ mail(:to => account.admin_emails,
36
+ :subject => I18n.t(:subject,
34
37
  :scope => [:billing_mailer, :new_unactivated],
35
38
  :default => "A check in from %{app_name}",
36
39
  :app_name => t("app_name")),
37
- :from => Saucy::Configuration.mailer_sender)
40
+ :reply_to => Saucy::Configuration.support_email_address,
41
+ :from => Saucy::Configuration.manager_email_address)
38
42
  end
39
43
  end
@@ -13,6 +13,6 @@ class InvitationMailer < ActionMailer::Base
13
13
  private
14
14
 
15
15
  def sender_name_and_support_address
16
- %{"#{@invitation.sender_name}" <#{Saucy::Configuration.mailer_sender}>}
16
+ %{"#{@invitation.sender_name}" <#{Saucy::Configuration.support_email_address}>}
17
17
  end
18
18
  end
@@ -18,6 +18,16 @@ Factory.define :account do |f|
18
18
  f.association :plan
19
19
  end
20
20
 
21
+ Factory.define :paid_account, :parent => :account do |f|
22
+ f.cardholder_name { "Ralph Robot" }
23
+ f.billing_email { "ralph@example.com" }
24
+ f.card_number { "4111111111111111" }
25
+ f.verification_code { "123" }
26
+ f.expiration_month { 5 }
27
+ f.expiration_year { 2012 }
28
+ f.association :plan, :factory => :paid_plan
29
+ end
30
+
21
31
  Factory.define :membership do |f|
22
32
  f.association :user
23
33
  f.association :account
@@ -3,12 +3,14 @@ require 'saucy/layouts'
3
3
  module Saucy
4
4
  class Configuration
5
5
  cattr_reader :layouts
6
- cattr_accessor :mailer_sender
6
+ cattr_accessor :manager_email_address
7
+ cattr_accessor :support_email_address
7
8
  cattr_accessor :merchant_account_id
8
9
  cattr_accessor :observers
9
10
 
10
11
  def initialize
11
- @@mailer_sender = 'donotreply@example.com'
12
+ @@manager_email_address = 'manager@example.com'
13
+ @@support_email_address = 'support@example.com'
12
14
  @@layouts = Layouts.new
13
15
  @@observers = []
14
16
  end
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ describe "with an account and transaction" do
4
+ let(:account) { Factory(:paid_account) }
5
+
6
+ before do
7
+ subscription = FakeBraintree.subscriptions[account.subscription_token]
8
+ subscription["transactions"] = [FakeBraintree.generated_transaction]
9
+ end
10
+
11
+ describe BillingMailer, "receipt" do
12
+ subject { BillingMailer.receipt(account, account.subscription.transactions.first) }
13
+
14
+ it "sends the receipt mail from the support address" do
15
+ subject.from.should == [Saucy::Configuration.support_email_address]
16
+ end
17
+
18
+ it "sets the receipt mail reply-to to the support address" do
19
+ subject.reply_to.should == [Saucy::Configuration.support_email_address]
20
+ end
21
+ end
22
+
23
+ describe BillingMailer, "problem" do
24
+ subject { BillingMailer.problem(account, account.subscription.transactions.first) }
25
+
26
+ it "sends the problem mail from the support address" do
27
+ subject.from.should == [Saucy::Configuration.support_email_address]
28
+ end
29
+
30
+ it "sets the problem mail reply-to to the support address" do
31
+ subject.reply_to.should == [Saucy::Configuration.support_email_address]
32
+ end
33
+ end
34
+
35
+ describe BillingMailer, "expiring trial" do
36
+ subject { BillingMailer.expiring_trial(account) }
37
+
38
+ it "sends the expiring trial mail from the support address" do
39
+ subject.from.should == [Saucy::Configuration.manager_email_address]
40
+ end
41
+
42
+ it "sets the expiring trial mail reply-to to the support address" do
43
+ subject.reply_to.should == [Saucy::Configuration.support_email_address]
44
+ end
45
+ end
46
+
47
+ describe BillingMailer, "new unactivated" do
48
+ subject { BillingMailer.expiring_trial(account) }
49
+
50
+ it "sends the new unactivated mail from the support address" do
51
+ subject.from.should == [Saucy::Configuration.manager_email_address]
52
+ end
53
+
54
+ it "sets the new unactivated mail reply-to to the support address" do
55
+ subject.reply_to.should == [Saucy::Configuration.support_email_address]
56
+ end
57
+ end
58
+ end
@@ -14,6 +14,6 @@ describe InvitationMailer, "invitation" do
14
14
  end
15
15
 
16
16
  it "sends from the support address" do
17
- subject.from.should == [Saucy::Configuration.mailer_sender]
17
+ subject.from.should == [Saucy::Configuration.support_email_address]
18
18
  end
19
19
  end
@@ -5,8 +5,12 @@ describe Saucy::Configuration do
5
5
  subject.layouts.should be_a(Saucy::Layouts)
6
6
  end
7
7
 
8
- it "has a mailer_sender" do
9
- subject.mailer_sender.should_not be_nil
8
+ it "has a manager_email_address" do
9
+ subject.manager_email_address.should_not be_nil
10
+ end
11
+
12
+ it "has a support_email_address" do
13
+ subject.support_email_address.should_not be_nil
10
14
  end
11
15
 
12
16
  it "has a nil merchant_account_id" do
@@ -30,13 +34,23 @@ describe Saucy::Configuration do
30
34
  end
31
35
  end
32
36
 
33
- it "can assign a mailer sender" do
34
- old_sender = subject.mailer_sender
37
+ it "can assign a manager email address" do
38
+ old_address = subject.manager_email_address
39
+ begin
40
+ subject.manager_email_address = 'newsender@example.com'
41
+ subject.manager_email_address.should == 'newsender@example.com'
42
+ ensure
43
+ subject.manager_email_address = old_address
44
+ end
45
+ end
46
+
47
+ it "can assign a support email address" do
48
+ old_address = subject.support_email_address
35
49
  begin
36
- subject.mailer_sender = 'newsender@example.com'
37
- subject.mailer_sender.should == 'newsender@example.com'
50
+ subject.support_email_address = 'newsender@example.com'
51
+ subject.support_email_address.should == 'newsender@example.com'
38
52
  ensure
39
- subject.mailer_sender = old_sender
53
+ subject.support_email_address = old_address
40
54
  end
41
55
  end
42
56
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saucy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
5
- prerelease: false
4
+ hash: 3
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 6
9
- - 1
10
- version: 0.6.1
8
+ - 7
9
+ - 0
10
+ version: 0.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc.
@@ -18,12 +18,12 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-05-03 00:00:00 -04:00
21
+ date: 2011-05-05 00:00:00 -04:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
25
- name: clearance
26
25
  prerelease: false
26
+ type: :runtime
27
27
  requirement: &id001 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
@@ -35,11 +35,11 @@ dependencies:
35
35
  - 11
36
36
  - 0
37
37
  version: 0.11.0
38
- type: :runtime
38
+ name: clearance
39
39
  version_requirements: *id001
40
40
  - !ruby/object:Gem::Dependency
41
- name: formtastic
42
41
  prerelease: false
42
+ type: :runtime
43
43
  requirement: &id002 !ruby/object:Gem::Requirement
44
44
  none: false
45
45
  requirements:
@@ -50,11 +50,11 @@ dependencies:
50
50
  - 1
51
51
  - 2
52
52
  version: "1.2"
53
- type: :runtime
53
+ name: formtastic
54
54
  version_requirements: *id002
55
55
  - !ruby/object:Gem::Dependency
56
- name: railties
57
56
  prerelease: false
57
+ type: :runtime
58
58
  requirement: &id003 !ruby/object:Gem::Requirement
59
59
  none: false
60
60
  requirements:
@@ -66,11 +66,11 @@ dependencies:
66
66
  - 0
67
67
  - 3
68
68
  version: 3.0.3
69
- type: :runtime
69
+ name: railties
70
70
  version_requirements: *id003
71
71
  - !ruby/object:Gem::Dependency
72
- name: braintree
73
72
  prerelease: false
73
+ type: :runtime
74
74
  requirement: &id004 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
@@ -82,11 +82,11 @@ dependencies:
82
82
  - 6
83
83
  - 2
84
84
  version: 2.6.2
85
- type: :runtime
85
+ name: braintree
86
86
  version_requirements: *id004
87
87
  - !ruby/object:Gem::Dependency
88
- name: sham_rack
89
88
  prerelease: false
89
+ type: :runtime
90
90
  requirement: &id005 !ruby/object:Gem::Requirement
91
91
  none: false
92
92
  requirements:
@@ -98,11 +98,11 @@ dependencies:
98
98
  - 3
99
99
  - 3
100
100
  version: 1.3.3
101
- type: :runtime
101
+ name: sham_rack
102
102
  version_requirements: *id005
103
103
  - !ruby/object:Gem::Dependency
104
- name: sinatra
105
104
  prerelease: false
105
+ type: :runtime
106
106
  requirement: &id006 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
@@ -114,11 +114,11 @@ dependencies:
114
114
  - 1
115
115
  - 2
116
116
  version: 1.1.2
117
- type: :runtime
117
+ name: sinatra
118
118
  version_requirements: *id006
119
119
  - !ruby/object:Gem::Dependency
120
- name: aruba
121
120
  prerelease: false
121
+ type: :development
122
122
  requirement: &id007 !ruby/object:Gem::Requirement
123
123
  none: false
124
124
  requirements:
@@ -130,7 +130,7 @@ dependencies:
130
130
  - 2
131
131
  - 6
132
132
  version: 0.2.6
133
- type: :development
133
+ name: aruba
134
134
  version_requirements: *id007
135
135
  description: Clearance-based Rails engine for Software as a Service (Saas) that provides account and project management
136
136
  email: support@thoughtbot.com
@@ -262,6 +262,7 @@ files:
262
262
  - spec/controllers/projects_controller_spec.rb
263
263
  - spec/environment.rb
264
264
  - spec/layouts_spec.rb
265
+ - spec/mailers/billing_mailer_spec.rb
265
266
  - spec/mailers/invitiation_mailer_spec.rb
266
267
  - spec/models/account_spec.rb
267
268
  - spec/models/invitation_spec.rb
@@ -313,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
313
314
  requirements: []
314
315
 
315
316
  rubyforge_project:
316
- rubygems_version: 1.3.7
317
+ rubygems_version: 1.6.2
317
318
  signing_key:
318
319
  specification_version: 3
319
320
  summary: Clearance-based Rails engine for SaaS