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.
- checksums.yaml +4 -4
- data/Gemfile +2 -9
- data/README.md +3 -1
- data/VERSION +1 -1
- data/app/controllers/paid_up/paid_up_controller.rb +9 -0
- data/app/controllers/paid_up/subscriptions_controller.rb +2 -2
- data/app/helpers/paid_up/plans_helper.rb +4 -1
- data/app/mailers/paid_up/paid_up_mailer.rb +6 -0
- data/app/mailers/paid_up/subscription_mailer.rb +9 -0
- data/app/views/layouts/mailer.html.haml +3 -0
- data/app/views/layouts/mailer.text.haml +1 -0
- data/app/views/paid_up/features/_abilities_table.html.haml +22 -2
- data/app/views/paid_up/subscription_mailer/payment_failed_email.html.haml +0 -0
- data/app/views/paid_up/subscription_mailer/payment_failed_email.text.haml +0 -0
- data/app/views/paid_up/subscriptions/index.html.haml +16 -14
- data/config/locales/en.yml +8 -0
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +162 -63
- data/lib/paid_up.rb +1 -2
- data/lib/paid_up/extensions/stripe.rb +1 -0
- data/lib/paid_up/mixins/subscriber.rb +27 -10
- data/paid_up.gemspec +15 -3
- data/spec/dummy/config/routes.rb +2 -15
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/seeds.rb +149 -121
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/tasks/system.rake +12 -0
- data/spec/dummy/log/development.log +16385 -10278
- data/spec/factories/user.rb +22 -8
- data/spec/mailers/paid_up/subscription_mailer_spec.rb +5 -0
- data/spec/mailers/previews/paid_up/subscription_mailer_preview.rb +7 -0
- metadata +25 -2
data/spec/factories/user.rb
CHANGED
@@ -1,25 +1,39 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :user do
|
3
|
-
email { "#{name.gsub(' ', '.').downcase}@
|
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
|
-
|
15
|
+
if evaluator.past_due
|
16
|
+
token = Stripe::Token.create(
|
15
17
|
card: {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
number: '4000000000000341',
|
19
|
+
exp_month: 1,
|
20
|
+
exp_year: 45,
|
21
|
+
cvc: '111'
|
20
22
|
}
|
21
|
-
|
22
|
-
|
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
|
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.
|
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-
|
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
|