saucy 0.10.9 → 0.10.10

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.10.10
2
+
3
+ * Add additional Airbrake notifications on failure scenarios
4
+
1
5
  0.10.9
2
6
 
3
7
  * Follow-up to 0.10.8: Actually work irrespective of system TZ
data/Gemfile CHANGED
@@ -14,6 +14,7 @@ gem "sinatra"
14
14
  gem "sham_rack"
15
15
  gem "braintree"
16
16
  gem "timecop"
17
+ gem "airbrake"
17
18
 
18
19
  # used by the rails app in cucumber
19
20
  gem "cucumber-rails", :require => false
data/Gemfile.lock CHANGED
@@ -28,6 +28,9 @@ GEM
28
28
  activemodel (= 3.0.5)
29
29
  activesupport (= 3.0.5)
30
30
  activesupport (3.0.5)
31
+ airbrake (3.0.4)
32
+ activesupport
33
+ builder
31
34
  arel (2.0.9)
32
35
  aruba (0.2.6)
33
36
  background_process
@@ -167,6 +170,7 @@ PLATFORMS
167
170
  ruby
168
171
 
169
172
  DEPENDENCIES
173
+ airbrake
170
174
  aruba
171
175
  bourne
172
176
  braintree
@@ -24,10 +24,34 @@
24
24
  <%= form.buttons do %>
25
25
  <%= form.commit_button "Update" %>
26
26
  <li>
27
- <%= link_to t(".delete", :default => "Delete my account"),
28
- @account,
29
- :method => :delete,
30
- :confirm => "Are you sure? All data will be irreversibly deleted." %>
27
+ <div id="account-deletion-warning">
28
+ <h3>Warning:</h3>
29
+ <p>
30
+ <%= t("saucy.account_deletion_effects_warning", :default => "When you cancel your Copycopter account, all of your text will be deleted from Copycopter. All of your projects on your severs will revert to their defaults, and you will not be able to recover your customized copy that is stored in Copycopter.") %>
31
+ </p>
32
+
33
+ <%= link_to t("saucy.confirm_account_deletion", :default => "I understand, delete my account"),
34
+ @account,
35
+ :class => "button warning",
36
+ :method => :delete,
37
+ :confirm => "Are you sure? All data will be irreversibly deleted." %>
38
+
39
+ <%= link_to t("saucy.cancel_account_deletion", :default => "On second thought, don't delete my account."),
40
+ root_path, :class => "cancel-account-deletion" %>
41
+ </div>
42
+
43
+ <%= link_to t(".delete", :default => "Delete my account"), "#", :class => "prompt-to-delete" %>
44
+
45
+ <% content_for :javascript do %>
46
+ <script type="text/javascript">
47
+ $(function() {
48
+ $("a.prompt-to-delete").click(function(event) {
49
+ $(event.target).hide();
50
+ $('#account-deletion-warning').slideDown();
51
+ });
52
+ });
53
+ </script>
54
+ <% end %>
31
55
  </li>
32
56
  <% end %>
33
57
  <% end %>
@@ -3,6 +3,9 @@ en:
3
3
  app_url: 'http://example.com'
4
4
  support_email: support@example.com
5
5
  saucy:
6
+ account_deletion_effects_warning: When you cancel your account, all of your data will be deleted from %{app_name}, and you will not be able to recover your data.
7
+ cancel_account_deletion: On second thought, don't delete my account.
8
+ confirm_account_deletion: I understand, delete my account
6
9
  billing_address: Billing Address
7
10
  errors:
8
11
  past_due:
@@ -24,12 +24,23 @@ Feature: Manage account
24
24
  When I follow "Users"
25
25
  Then I should see "captain@awesome.com"
26
26
 
27
+ @javascript
27
28
  Scenario: Delete account
28
29
  Given an account exists with a name of "Chocolate"
29
30
  And I am signed in as an admin of the "Chocolate" account
30
31
  When I go to the settings page for the "Chocolate" account
31
- And I follow "Delete"
32
+ And I follow "Delete my account"
33
+ Then I should see "Warning"
34
+ When I follow "I understand"
32
35
  Then I should see "Your account has been deleted"
33
36
  When I go to the dashboard page
34
37
  Then I should not see "Chocolate"
35
38
 
39
+ @javascript
40
+ Scenario: Cancel deleting account
41
+ Given an account exists with a name of "Chocolate"
42
+ And I am signed in as an admin of the "Chocolate" account
43
+ When I go to the settings page for the "Chocolate" account
44
+ And I follow "Delete my account"
45
+ And I follow "don't delete my account"
46
+ Then I should not see "Your account has been deleted"
@@ -1,3 +1,5 @@
1
+ require 'airbrake'
2
+
1
3
  module Saucy
2
4
  module Subscription
3
5
  extend ActiveSupport::Concern
@@ -111,7 +113,20 @@ module Saucy
111
113
  if valid?
112
114
  result = Braintree::Customer.update(customer_token, customer_attributes)
113
115
  handle_customer_result(result)
116
+ if !result.success?
117
+ Airbrake.notify(
118
+ :error_class => "Customer update",
119
+ :error_message => "Customer update failed",
120
+ :parameters => { :customer_token => customer_token, :customer_attributes => customer_attributes }
121
+ )
122
+ end
114
123
  result.success?
124
+ else
125
+ Airbrake.notify(
126
+ :error_class => "Subscription Validation",
127
+ :error_message => "Customer failed validation",
128
+ :parameters => customer_attributes
129
+ )
115
130
  end
116
131
  end
117
132
 
@@ -176,6 +191,11 @@ module Saucy
176
191
  end
177
192
 
178
193
  def handle_errors(result, remote_errors)
194
+ Airbrake.notify(
195
+ :error_class => "handle_errors",
196
+ :error_message => "handle_errors",
197
+ :parameters => { :result => result, :remote_errors => remote_errors }
198
+ )
179
199
  if result && result.status == "processor_declined"
180
200
  errors[:card_number] << "was denied by the payment processor with the message: #{result.processor_response_text}"
181
201
  elsif result && result.status == "gateway_rejected"
@@ -203,6 +223,11 @@ module Saucy
203
223
  self.next_billing_date = zone.parse(result.subscription.next_billing_date)
204
224
  self.subscription_status = result.subscription.status
205
225
  else
226
+ Airbrake.notify(
227
+ :error_class => "Subscription creation",
228
+ :error_message => "Subscription creation failed",
229
+ :parameters => subscription_attributes
230
+ )
206
231
  false
207
232
  end
208
233
  end
@@ -28,4 +28,8 @@ body {
28
28
 
29
29
  #container .search {
30
30
  float: right;
31
- }
31
+ }
32
+
33
+ div#account-deletion-warning {
34
+ display: none;
35
+ }
@@ -295,6 +295,8 @@ describe Account, "with a paid subscription" do
295
295
  :plan => Factory(:paid_plan))
296
296
  end
297
297
 
298
+ let(:merchant_time_zone) { ActiveSupport::TimeZone[Saucy::Configuration.merchant_account_time_zone] }
299
+
298
300
  it "gets marked as past due and updates its next_billing_date when subscriptions are updated and it has been rejected by the gateway" do
299
301
  next_billing_date_string = 2.months.from_now.to_s(:braintree_date)
300
302
  subscription = FakeBraintree.subscriptions[subject.subscription_token]
@@ -304,8 +306,7 @@ describe Account, "with a paid subscription" do
304
306
  Timecop.travel(subject.next_billing_date + 1.day) do
305
307
  Account.update_subscriptions!
306
308
  subject.reload.subscription_status.should == Braintree::Subscription::Status::PastDue
307
- subject.next_billing_date.should == Time.parse(next_billing_date_string).in_time_zone(
308
- Saucy::Configuration.merchant_account_time_zone)
309
+ subject.next_billing_date.should == merchant_time_zone.parse(next_billing_date_string)
309
310
  subject.past_due?.should be
310
311
  end
311
312
  end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saucy
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 35
4
5
  prerelease:
5
- version: 0.10.9
6
+ segments:
7
+ - 0
8
+ - 10
9
+ - 10
10
+ version: 0.10.10
6
11
  platform: ruby
7
12
  authors:
8
13
  - thoughtbot, inc.
@@ -15,85 +20,135 @@ autorequire:
15
20
  bindir: bin
16
21
  cert_chain: []
17
22
 
18
- date: 2011-10-17 00:00:00 Z
23
+ date: 2011-11-01 00:00:00 Z
19
24
  dependencies:
20
25
  - !ruby/object:Gem::Dependency
21
26
  name: clearance
27
+ prerelease: false
22
28
  requirement: &id001 !ruby/object:Gem::Requirement
23
29
  none: false
24
30
  requirements:
25
31
  - - ~>
26
32
  - !ruby/object:Gem::Version
33
+ hash: 55
34
+ segments:
35
+ - 0
36
+ - 11
37
+ - 2
27
38
  version: 0.11.2
28
39
  type: :runtime
29
- prerelease: false
30
40
  version_requirements: *id001
31
41
  - !ruby/object:Gem::Dependency
32
42
  name: formtastic
43
+ prerelease: false
33
44
  requirement: &id002 !ruby/object:Gem::Requirement
34
45
  none: false
35
46
  requirements:
36
47
  - - ">="
37
48
  - !ruby/object:Gem::Version
49
+ hash: 11
50
+ segments:
51
+ - 1
52
+ - 2
38
53
  version: "1.2"
39
54
  type: :runtime
40
- prerelease: false
41
55
  version_requirements: *id002
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: railties
58
+ prerelease: false
44
59
  requirement: &id003 !ruby/object:Gem::Requirement
45
60
  none: false
46
61
  requirements:
47
62
  - - ">="
48
63
  - !ruby/object:Gem::Version
64
+ hash: 1
65
+ segments:
66
+ - 3
67
+ - 0
68
+ - 3
49
69
  version: 3.0.3
50
70
  type: :runtime
51
- prerelease: false
52
71
  version_requirements: *id003
53
72
  - !ruby/object:Gem::Dependency
54
73
  name: braintree
74
+ prerelease: false
55
75
  requirement: &id004 !ruby/object:Gem::Requirement
56
76
  none: false
57
77
  requirements:
58
78
  - - ">="
59
79
  - !ruby/object:Gem::Version
80
+ hash: 19
81
+ segments:
82
+ - 2
83
+ - 6
84
+ - 2
60
85
  version: 2.6.2
61
86
  type: :runtime
62
- prerelease: false
63
87
  version_requirements: *id004
64
88
  - !ruby/object:Gem::Dependency
65
89
  name: sham_rack
90
+ prerelease: false
66
91
  requirement: &id005 !ruby/object:Gem::Requirement
67
92
  none: false
68
93
  requirements:
69
94
  - - "="
70
95
  - !ruby/object:Gem::Version
96
+ hash: 29
97
+ segments:
98
+ - 1
99
+ - 3
100
+ - 3
71
101
  version: 1.3.3
72
102
  type: :runtime
73
- prerelease: false
74
103
  version_requirements: *id005
75
104
  - !ruby/object:Gem::Dependency
76
105
  name: sinatra
106
+ prerelease: false
77
107
  requirement: &id006 !ruby/object:Gem::Requirement
78
108
  none: false
79
109
  requirements:
80
110
  - - ">="
81
111
  - !ruby/object:Gem::Version
112
+ hash: 23
113
+ segments:
114
+ - 1
115
+ - 1
116
+ - 2
82
117
  version: 1.1.2
83
118
  type: :runtime
84
- prerelease: false
85
119
  version_requirements: *id006
86
120
  - !ruby/object:Gem::Dependency
87
- name: aruba
121
+ name: airbrake
122
+ prerelease: false
88
123
  requirement: &id007 !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ hash: 15
129
+ segments:
130
+ - 3
131
+ - 0
132
+ - 4
133
+ version: 3.0.4
134
+ type: :runtime
135
+ version_requirements: *id007
136
+ - !ruby/object:Gem::Dependency
137
+ name: aruba
138
+ prerelease: false
139
+ requirement: &id008 !ruby/object:Gem::Requirement
89
140
  none: false
90
141
  requirements:
91
142
  - - "="
92
143
  - !ruby/object:Gem::Version
144
+ hash: 27
145
+ segments:
146
+ - 0
147
+ - 2
148
+ - 6
93
149
  version: 0.2.6
94
150
  type: :development
95
- prerelease: false
96
- version_requirements: *id007
151
+ version_requirements: *id008
97
152
  description: Clearance-based Rails engine for Software as a Service (Saas) that provides account and project management
98
153
  email: support@thoughtbot.com
99
154
  executables: []
@@ -287,7 +342,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
287
342
  requirements:
288
343
  - - ">="
289
344
  - !ruby/object:Gem::Version
290
- hash: -2922648281484856857
345
+ hash: 3
291
346
  segments:
292
347
  - 0
293
348
  version: "0"
@@ -296,11 +351,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
296
351
  requirements:
297
352
  - - ">="
298
353
  - !ruby/object:Gem::Version
354
+ hash: 3
355
+ segments:
356
+ - 0
299
357
  version: "0"
300
358
  requirements: []
301
359
 
302
360
  rubyforge_project:
303
- rubygems_version: 1.8.10
361
+ rubygems_version: 1.8.11
304
362
  signing_key:
305
363
  specification_version: 3
306
364
  summary: Clearance-based Rails engine for SaaS