paid_up 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,25 +1,39 @@
1
1
  FactoryGirl.define do
2
2
  factory :user do
3
- email { "#{name.gsub(' ', '.').downcase}@example.com" }
3
+ email { "#{name.gsub(' ', '.').downcase}@gemvein.com" }
4
4
  password "password"
5
5
  password_confirmation "password"
6
6
  transient do
7
7
  plan { PaidUp::Plan.order("RANDOM()").first }
8
+ past_due false
8
9
  end
9
10
  # the after(:create) yields two values; the user instance itself and the
10
11
  # evaluator, which stores all values from the factory, including transient
11
12
  # attributes; `create_list`'s second argument is the number of records
12
13
  # to create and we make sure the user is associated properly to the post
13
14
  after(:create) do |user, evaluator|
14
- token = Stripe::Token.create(
15
+ if evaluator.past_due
16
+ token = Stripe::Token.create(
15
17
  card: {
16
- number: '4242424242424242',
17
- exp_month: 1,
18
- exp_year: 45,
19
- cvc: '111'
18
+ number: '4000000000000341',
19
+ exp_month: 1,
20
+ exp_year: 45,
21
+ cvc: '111'
20
22
  }
21
- ).id
22
- user.subscribe_to_plan(evaluator.plan, token)
23
+ ).id
24
+ trial_end = 5.seconds.from_now.to_time.to_i
25
+ else
26
+ token = Stripe::Token.create(
27
+ card: {
28
+ number: '4242424242424242',
29
+ exp_month: 1,
30
+ exp_year: 45,
31
+ cvc: '111'
32
+ }
33
+ ).id
34
+ trial_end = nil
35
+ end
36
+ user.subscribe_to_plan(evaluator.plan, token, trial_end)
23
37
  end
24
38
  end
25
39
  end
@@ -0,0 +1,5 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.describe SubscriptionMailer, type: :mailer do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
@@ -0,0 +1,7 @@
1
+ # Preview all emails at http://localhost:3000/rails/mailers/subscription_mailer
2
+ class SubscriptionMailerPreview < ActionMailer::Preview
3
+ def failed_payment_email
4
+ @invoice = nil
5
+ SubscriptionMailer.failed_payment_email
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paid_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karen Lundgren
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-14 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: '1'
209
+ - !ruby/object:Gem::Dependency
210
+ name: web-console
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '3.0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '3.0'
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: sqlite3
211
225
  requirement: !ruby/object:Gem::Requirement
@@ -328,6 +342,8 @@ files:
328
342
  - app/helpers/paid_up/paid_up_helper.rb
329
343
  - app/helpers/paid_up/plans_helper.rb
330
344
  - app/helpers/paid_up/subscriptions_helper.rb
345
+ - app/mailers/paid_up/paid_up_mailer.rb
346
+ - app/mailers/paid_up/subscription_mailer.rb
331
347
  - app/models/paid_up/ability.rb
332
348
  - app/models/paid_up/plan.rb
333
349
  - app/models/paid_up/plan_feature_setting.rb
@@ -342,9 +358,13 @@ files:
342
358
  - app/views/devise/sessions/new.html.haml
343
359
  - app/views/devise/shared/_links.html.haml
344
360
  - app/views/devise/unlocks/new.html.haml
361
+ - app/views/layouts/mailer.html.haml
362
+ - app/views/layouts/mailer.text.haml
345
363
  - app/views/paid_up/features/_abilities_table.html.haml
346
364
  - app/views/paid_up/features/_table.html.haml
347
365
  - app/views/paid_up/plans/index.html.haml
366
+ - app/views/paid_up/subscription_mailer/payment_failed_email.html.haml
367
+ - app/views/paid_up/subscription_mailer/payment_failed_email.text.haml
348
368
  - app/views/paid_up/subscriptions/index.html.haml
349
369
  - app/views/paid_up/subscriptions/new.html.haml
350
370
  - config/initializers/stripe.rb
@@ -433,6 +453,7 @@ files:
433
453
  - spec/dummy/db/seeds.rb
434
454
  - spec/dummy/db/test.sqlite3
435
455
  - spec/dummy/lib/assets/.keep
456
+ - spec/dummy/lib/tasks/system.rake
436
457
  - spec/dummy/log/.keep
437
458
  - spec/dummy/log/development.log
438
459
  - spec/dummy/public/404.html
@@ -451,6 +472,8 @@ files:
451
472
  - spec/factories/plan.rb
452
473
  - spec/factories/plan_feature_setting.rb
453
474
  - spec/factories/user.rb
475
+ - spec/mailers/paid_up/subscription_mailer_spec.rb
476
+ - spec/mailers/previews/paid_up/subscription_mailer_preview.rb
454
477
  - spec/models/group_spec.rb
455
478
  - spec/models/paid_up/feature_spec.rb
456
479
  - spec/models/paid_up/plan_feature_setting_spec.rb