saucy 0.2.28 → 0.2.28.1
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/lib/saucy/subscription.rb +1 -1
- data/spec/models/subscription_spec.rb +20 -0
- metadata +11 -10
data/lib/saucy/subscription.rb
CHANGED
|
@@ -213,7 +213,7 @@ module Saucy
|
|
|
213
213
|
|
|
214
214
|
module ClassMethods
|
|
215
215
|
def update_subscriptions!
|
|
216
|
-
recently_billed = where("next_billing_date <=
|
|
216
|
+
recently_billed = where("next_billing_date <= ?", Time.now)
|
|
217
217
|
recently_billed.each do |account|
|
|
218
218
|
account.subscription_status = account.subscription.status
|
|
219
219
|
account.next_billing_date = account.subscription.next_billing_date
|
|
@@ -309,6 +309,26 @@ describe Account, "with a paid subscription" do
|
|
|
309
309
|
end
|
|
310
310
|
end
|
|
311
311
|
|
|
312
|
+
it "doesn't receive a receipt email when it's already been billed" do
|
|
313
|
+
subscription = FakeBraintree.subscriptions[subject.subscription_token]
|
|
314
|
+
subscription["status"] = Braintree::Subscription::Status::Active
|
|
315
|
+
subscription["next_billing_date"] = 2.months.from_now
|
|
316
|
+
FakeBraintree.transaction = { :status => Braintree::Transaction::Status::Settled,
|
|
317
|
+
:subscription_id => subject.subscription_token }
|
|
318
|
+
subscription["transactions"] = [FakeBraintree.generated_transaction]
|
|
319
|
+
|
|
320
|
+
Timecop.travel(subject.next_billing_date - 1.day) do
|
|
321
|
+
ActionMailer::Base.deliveries.clear
|
|
322
|
+
|
|
323
|
+
Account.update_subscriptions!
|
|
324
|
+
|
|
325
|
+
ActionMailer::Base.deliveries.select do |email|
|
|
326
|
+
email.to == [subject.billing_email] &&
|
|
327
|
+
email.subject =~ /receipt/i
|
|
328
|
+
end.should be_empty
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
|
|
312
332
|
it "receives a receipt email at it's billing email with a notice that it failed when billing didn't work" do
|
|
313
333
|
subscription = FakeBraintree.subscriptions[subject.subscription_token]
|
|
314
334
|
subscription["status"] = Braintree::Subscription::Status::PastDue
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: saucy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 45
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
9
|
- 28
|
|
10
|
-
|
|
10
|
+
- 1
|
|
11
|
+
version: 0.2.28.1
|
|
11
12
|
platform: ruby
|
|
12
13
|
authors:
|
|
13
14
|
- thoughtbot, inc.
|
|
@@ -17,7 +18,7 @@ autorequire:
|
|
|
17
18
|
bindir: bin
|
|
18
19
|
cert_chain: []
|
|
19
20
|
|
|
20
|
-
date: 2011-
|
|
21
|
+
date: 2011-04-20 00:00:00 -04:00
|
|
21
22
|
default_executable:
|
|
22
23
|
dependencies:
|
|
23
24
|
- !ruby/object:Gem::Dependency
|
|
@@ -32,8 +33,8 @@ dependencies:
|
|
|
32
33
|
- 1
|
|
33
34
|
- 2
|
|
34
35
|
version: "1.2"
|
|
35
|
-
name: formtastic
|
|
36
36
|
version_requirements: *id001
|
|
37
|
+
name: formtastic
|
|
37
38
|
prerelease: false
|
|
38
39
|
- !ruby/object:Gem::Dependency
|
|
39
40
|
type: :runtime
|
|
@@ -48,8 +49,8 @@ dependencies:
|
|
|
48
49
|
- 0
|
|
49
50
|
- 3
|
|
50
51
|
version: 3.0.3
|
|
51
|
-
name: railties
|
|
52
52
|
version_requirements: *id002
|
|
53
|
+
name: railties
|
|
53
54
|
prerelease: false
|
|
54
55
|
- !ruby/object:Gem::Dependency
|
|
55
56
|
type: :runtime
|
|
@@ -64,8 +65,8 @@ dependencies:
|
|
|
64
65
|
- 6
|
|
65
66
|
- 2
|
|
66
67
|
version: 2.6.2
|
|
67
|
-
name: braintree
|
|
68
68
|
version_requirements: *id003
|
|
69
|
+
name: braintree
|
|
69
70
|
prerelease: false
|
|
70
71
|
- !ruby/object:Gem::Dependency
|
|
71
72
|
type: :runtime
|
|
@@ -80,8 +81,8 @@ dependencies:
|
|
|
80
81
|
- 3
|
|
81
82
|
- 3
|
|
82
83
|
version: 1.3.3
|
|
83
|
-
name: sham_rack
|
|
84
84
|
version_requirements: *id004
|
|
85
|
+
name: sham_rack
|
|
85
86
|
prerelease: false
|
|
86
87
|
- !ruby/object:Gem::Dependency
|
|
87
88
|
type: :runtime
|
|
@@ -96,8 +97,8 @@ dependencies:
|
|
|
96
97
|
- 1
|
|
97
98
|
- 2
|
|
98
99
|
version: 1.1.2
|
|
99
|
-
name: sinatra
|
|
100
100
|
version_requirements: *id005
|
|
101
|
+
name: sinatra
|
|
101
102
|
prerelease: false
|
|
102
103
|
- !ruby/object:Gem::Dependency
|
|
103
104
|
type: :development
|
|
@@ -112,8 +113,8 @@ dependencies:
|
|
|
112
113
|
- 2
|
|
113
114
|
- 6
|
|
114
115
|
version: 0.2.6
|
|
115
|
-
name: aruba
|
|
116
116
|
version_requirements: *id006
|
|
117
|
+
name: aruba
|
|
117
118
|
prerelease: false
|
|
118
119
|
description: Clearance-based Rails engine for Software as a Service (Saas) that provides account and project management
|
|
119
120
|
email: support@thoughtbot.com
|
|
@@ -286,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
286
287
|
requirements: []
|
|
287
288
|
|
|
288
289
|
rubyforge_project:
|
|
289
|
-
rubygems_version: 1.
|
|
290
|
+
rubygems_version: 1.6.1
|
|
290
291
|
signing_key:
|
|
291
292
|
specification_version: 3
|
|
292
293
|
summary: Clearance-based Rails engine for SaaS
|