saucy 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -220,7 +220,7 @@ module Saucy
220
220
 
221
221
  module ClassMethods
222
222
  def update_subscriptions!
223
- recently_billed = where("next_billing_date <= '#{Time.now}'")
223
+ recently_billed = where("next_billing_date <= ?", Time.now)
224
224
  recently_billed.each do |account|
225
225
  account.subscription_status = account.subscription.status
226
226
  account.next_billing_date = account.subscription.next_billing_date
@@ -341,6 +341,26 @@ describe Account, "with a paid subscription" do
341
341
  end
342
342
  end
343
343
 
344
+ it "doesn't receive a receipt email when it's already been billed" do
345
+ subscription = FakeBraintree.subscriptions[subject.subscription_token]
346
+ subscription["status"] = Braintree::Subscription::Status::Active
347
+ subscription["next_billing_date"] = 2.months.from_now
348
+ FakeBraintree.transaction = { :status => Braintree::Transaction::Status::Settled,
349
+ :subscription_id => subject.subscription_token }
350
+ subscription["transactions"] = [FakeBraintree.generated_transaction]
351
+
352
+ Timecop.travel(subject.next_billing_date - 1.day) do
353
+ ActionMailer::Base.deliveries.clear
354
+
355
+ Account.update_subscriptions!
356
+
357
+ ActionMailer::Base.deliveries.select do |email|
358
+ email.to == [subject.billing_email] &&
359
+ email.subject =~ /receipt/i
360
+ end.should be_empty
361
+ end
362
+ end
363
+
344
364
  it "receives a receipt email at it's billing email with a notice that it failed when billing didn't work" do
345
365
  subscription = FakeBraintree.subscriptions[subject.subscription_token]
346
366
  subscription["status"] = Braintree::Subscription::Status::PastDue
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: 31
5
- prerelease: false
4
+ hash: 29
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 8
10
- version: 0.4.8
9
+ - 9
10
+ version: 0.4.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc.
@@ -22,8 +22,7 @@ date: 2011-04-20 00:00:00 -04:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
25
- name: formtastic
26
- prerelease: false
25
+ type: :runtime
27
26
  requirement: &id001 !ruby/object:Gem::Requirement
28
27
  none: false
29
28
  requirements:
@@ -34,11 +33,11 @@ dependencies:
34
33
  - 1
35
34
  - 2
36
35
  version: "1.2"
37
- type: :runtime
38
36
  version_requirements: *id001
39
- - !ruby/object:Gem::Dependency
40
- name: railties
37
+ name: formtastic
41
38
  prerelease: false
39
+ - !ruby/object:Gem::Dependency
40
+ type: :runtime
42
41
  requirement: &id002 !ruby/object:Gem::Requirement
43
42
  none: false
44
43
  requirements:
@@ -50,11 +49,11 @@ dependencies:
50
49
  - 0
51
50
  - 3
52
51
  version: 3.0.3
53
- type: :runtime
54
52
  version_requirements: *id002
55
- - !ruby/object:Gem::Dependency
56
- name: braintree
53
+ name: railties
57
54
  prerelease: false
55
+ - !ruby/object:Gem::Dependency
56
+ type: :runtime
58
57
  requirement: &id003 !ruby/object:Gem::Requirement
59
58
  none: false
60
59
  requirements:
@@ -66,11 +65,11 @@ dependencies:
66
65
  - 6
67
66
  - 2
68
67
  version: 2.6.2
69
- type: :runtime
70
68
  version_requirements: *id003
71
- - !ruby/object:Gem::Dependency
72
- name: sham_rack
69
+ name: braintree
73
70
  prerelease: false
71
+ - !ruby/object:Gem::Dependency
72
+ type: :runtime
74
73
  requirement: &id004 !ruby/object:Gem::Requirement
75
74
  none: false
76
75
  requirements:
@@ -82,11 +81,11 @@ dependencies:
82
81
  - 3
83
82
  - 3
84
83
  version: 1.3.3
85
- type: :runtime
86
84
  version_requirements: *id004
87
- - !ruby/object:Gem::Dependency
88
- name: sinatra
85
+ name: sham_rack
89
86
  prerelease: false
87
+ - !ruby/object:Gem::Dependency
88
+ type: :runtime
90
89
  requirement: &id005 !ruby/object:Gem::Requirement
91
90
  none: false
92
91
  requirements:
@@ -98,11 +97,11 @@ dependencies:
98
97
  - 1
99
98
  - 2
100
99
  version: 1.1.2
101
- type: :runtime
102
100
  version_requirements: *id005
103
- - !ruby/object:Gem::Dependency
104
- name: aruba
101
+ name: sinatra
105
102
  prerelease: false
103
+ - !ruby/object:Gem::Dependency
104
+ type: :development
106
105
  requirement: &id006 !ruby/object:Gem::Requirement
107
106
  none: false
108
107
  requirements:
@@ -114,8 +113,9 @@ dependencies:
114
113
  - 2
115
114
  - 6
116
115
  version: 0.2.6
117
- type: :development
118
116
  version_requirements: *id006
117
+ name: aruba
118
+ prerelease: false
119
119
  description: Clearance-based Rails engine for Software as a Service (Saas) that provides account and project management
120
120
  email: support@thoughtbot.com
121
121
  executables: []
@@ -296,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
296
296
  requirements: []
297
297
 
298
298
  rubyforge_project:
299
- rubygems_version: 1.3.7
299
+ rubygems_version: 1.6.1
300
300
  signing_key:
301
301
  specification_version: 3
302
302
  summary: Clearance-based Rails engine for SaaS