stripe_saas 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.asc +1 -1
- data/Rakefile +1 -13
- data/app/assets/javascripts/stripe_saas/application.js +1 -1
- data/app/concerns/stripe_saas/plan.rb +22 -3
- data/app/concerns/stripe_saas/plan_feature.rb +4 -4
- data/app/concerns/stripe_saas/subscription.rb +1 -2
- data/lib/generators/stripe_saas/install_generator.rb +1 -1
- data/lib/generators/stripe_saas/templates/app/models/plan_feature.rb +2 -0
- data/lib/stripe_saas/engine.rb +4 -0
- data/lib/stripe_saas/version.rb +1 -1
- data/spec/dummy/app/assets/javascripts/application.js +1 -1
- data/spec/dummy/app/models/feature.rb +8 -0
- data/spec/dummy/app/models/plan.rb +4 -2
- data/spec/dummy/app/models/plan_feature.rb +6 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20150102001930_create_plans.rb +0 -1
- data/spec/dummy/db/migrate/20151220161809_create_features.rb +14 -0
- data/spec/dummy/db/migrate/20151220161817_create_plan_features.rb +12 -0
- data/spec/dummy/db/schema.rb +21 -2
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +3215 -0
- data/spec/models/feature_spec.rb +36 -0
- data/spec/models/plan_feature_spec.rb +89 -0
- data/spec/models/plan_spec.rb +137 -0
- data/spec/models/subscription_spec.rb +73 -0
- data/spec/spec_helper.rb +11 -3
- metadata +20 -9
- data/spec/concerns/plan_spec.rb +0 -50
- data/spec/dummy/log/development.log +0 -170
- data/spec/integration/navigation_test.rb +0 -9
data/spec/concerns/plan_spec.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
describe StripeSaas::Plan do
|
4
|
-
describe '#is_upgrade_from?' do
|
5
|
-
|
6
|
-
it 'returns true if the price is higher' do
|
7
|
-
plan = Plan.new
|
8
|
-
plan.price = 123.23
|
9
|
-
cheaper_plan = Plan.new
|
10
|
-
cheaper_plan.price = 61.61
|
11
|
-
expect(plan.is_upgrade_from?(cheaper_plan)).to be true
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'returns true if the price is the same' do
|
15
|
-
plan = Plan.new
|
16
|
-
plan.price = 123.23
|
17
|
-
expect(plan.is_upgrade_from?(plan)).to be true
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'returns false if the price is the same or higher' do
|
21
|
-
plan = Plan.new
|
22
|
-
plan.price = 61.61
|
23
|
-
more_expensive_plan = Plan.new
|
24
|
-
more_expensive_plan.price = 123.23
|
25
|
-
expect(plan.is_upgrade_from?(more_expensive_plan)).to be false
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'handles a nil value gracefully' do
|
29
|
-
plan = Plan.new
|
30
|
-
plan.price = 123.23
|
31
|
-
cheaper_plan = Plan.new
|
32
|
-
|
33
|
-
expect(plan.is_upgrade_from?(cheaper_plan)).to be true
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'returns whether the plan is a free plan' do
|
37
|
-
plan = Plan.new
|
38
|
-
plan.price = 0.0
|
39
|
-
expect(plan).to be_free
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'plan features' do
|
45
|
-
# before {
|
46
|
-
# feature_a = Feature.new
|
47
|
-
# feature_b = Feature.new
|
48
|
-
# }
|
49
|
-
end
|
50
|
-
end
|
@@ -1,170 +0,0 @@
|
|
1
|
-
[1m[36m (1.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
2
|
-
[1m[35m (0.5ms)[0m select sqlite_version(*)
|
3
|
-
[1m[36m (1.0ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
4
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
5
|
-
Migrating to DeviseCreateUsers (20150101233243)
|
6
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
7
|
-
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/bsb/Projects/integrallis-open-source/stripe_saas/spec/dummy/db/migrate/20150101233243_devise_create_users.rb:34)
|
8
|
-
[1m[35m (1.1ms)[0m CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar DEFAULT '' NOT NULL, "encrypted_password" varchar DEFAULT '' NOT NULL, "reset_password_token" varchar, "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar, "last_sign_in_ip" varchar, "created_at" datetime, "updated_at" datetime)
|
9
|
-
[1m[36m (1.4ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")[0m
|
10
|
-
[1m[35m (0.1ms)[0m SELECT sql
|
11
|
-
FROM sqlite_master
|
12
|
-
WHERE name='index_users_on_email' AND type='index'
|
13
|
-
UNION ALL
|
14
|
-
SELECT sql
|
15
|
-
FROM sqlite_temp_master
|
16
|
-
WHERE name='index_users_on_email' AND type='index'
|
17
|
-
|
18
|
-
[1m[36m (0.2ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
19
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150101233243"]]
|
20
|
-
[1m[36m (1.1ms)[0m [1mcommit transaction[0m
|
21
|
-
Migrating to CreateSubscriptions (20150102001921)
|
22
|
-
[1m[35m (0.1ms)[0m begin transaction
|
23
|
-
[1m[36m (0.4ms)[0m [1mCREATE TABLE "subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "plan_id" integer, "last_four" varchar, "card_type" varchar, "current_price_cents" integer, "user_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
24
|
-
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150102001921"]]
|
25
|
-
[1m[36m (0.8ms)[0m [1mcommit transaction[0m
|
26
|
-
Migrating to CreatePlans (20150102001930)
|
27
|
-
[1m[35m (0.1ms)[0m begin transaction
|
28
|
-
[1m[36m (0.4ms)[0m [1mCREATE TABLE "plans" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "stripe_id" varchar, "price_cents" integer, "interval" varchar, "features" text, "highlight" boolean, "display_order" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
29
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150102001930"]]
|
30
|
-
[1m[36m (0.8ms)[0m [1mcommit transaction[0m
|
31
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
32
|
-
[1m[36m (0.1ms)[0m [1m SELECT sql
|
33
|
-
FROM sqlite_master
|
34
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
35
|
-
UNION ALL
|
36
|
-
SELECT sql
|
37
|
-
FROM sqlite_temp_master
|
38
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
39
|
-
[0m
|
40
|
-
[1m[35m (0.1ms)[0m SELECT sql
|
41
|
-
FROM sqlite_master
|
42
|
-
WHERE name='index_users_on_email' AND type='index'
|
43
|
-
UNION ALL
|
44
|
-
SELECT sql
|
45
|
-
FROM sqlite_temp_master
|
46
|
-
WHERE name='index_users_on_email' AND type='index'
|
47
|
-
|
48
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
49
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
50
|
-
Migrating to CreatePlans (20150102001930)
|
51
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
52
|
-
[1m[35m (2.4ms)[0m DROP TABLE "plans"
|
53
|
-
[1m[36mSQL (0.3ms)[0m [1mDELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = ?[0m [["version", "20150102001930"]]
|
54
|
-
[1m[35m (1.0ms)[0m commit transaction
|
55
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
56
|
-
[1m[35m (0.2ms)[0m SELECT sql
|
57
|
-
FROM sqlite_master
|
58
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
59
|
-
UNION ALL
|
60
|
-
SELECT sql
|
61
|
-
FROM sqlite_temp_master
|
62
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
63
|
-
|
64
|
-
[1m[36m (0.2ms)[0m [1m SELECT sql
|
65
|
-
FROM sqlite_master
|
66
|
-
WHERE name='index_users_on_email' AND type='index'
|
67
|
-
UNION ALL
|
68
|
-
SELECT sql
|
69
|
-
FROM sqlite_temp_master
|
70
|
-
WHERE name='index_users_on_email' AND type='index'
|
71
|
-
[0m
|
72
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
73
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
74
|
-
Migrating to CreateSubscriptions (20150102001921)
|
75
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
76
|
-
[1m[35m (0.5ms)[0m DROP TABLE "subscriptions"
|
77
|
-
[1m[36mSQL (0.3ms)[0m [1mDELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = ?[0m [["version", "20150102001921"]]
|
78
|
-
[1m[35m (0.9ms)[0m commit transaction
|
79
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
80
|
-
[1m[35m (0.3ms)[0m SELECT sql
|
81
|
-
FROM sqlite_master
|
82
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
83
|
-
UNION ALL
|
84
|
-
SELECT sql
|
85
|
-
FROM sqlite_temp_master
|
86
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
87
|
-
|
88
|
-
[1m[36m (0.2ms)[0m [1m SELECT sql
|
89
|
-
FROM sqlite_master
|
90
|
-
WHERE name='index_users_on_email' AND type='index'
|
91
|
-
UNION ALL
|
92
|
-
SELECT sql
|
93
|
-
FROM sqlite_temp_master
|
94
|
-
WHERE name='index_users_on_email' AND type='index'
|
95
|
-
[0m
|
96
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
97
|
-
Migrating to CreateSubscriptions (20150102001921)
|
98
|
-
[1m[35m (0.1ms)[0m begin transaction
|
99
|
-
[1m[36m (0.9ms)[0m [1mCREATE TABLE "subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "plan_id" integer, "last_four" varchar, "card_type" varchar, "current_price_cents" integer, "user_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
100
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150102001921"]]
|
101
|
-
[1m[36m (0.9ms)[0m [1mcommit transaction[0m
|
102
|
-
Migrating to CreatePlans (20150102001930)
|
103
|
-
[1m[35m (0.1ms)[0m begin transaction
|
104
|
-
[1m[36m (0.4ms)[0m [1mCREATE TABLE "plans" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "name" varchar, "price_cents" integer, "interval" varchar, "interval_count" integer, "trial_period_days" integer, "metadata_as_json" text, "features_as_json" text, "highlight" boolean, "display_order" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
105
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150102001930"]]
|
106
|
-
[1m[36m (1.1ms)[0m [1mcommit transaction[0m
|
107
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.3ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
108
|
-
[1m[36m (0.3ms)[0m [1m SELECT sql
|
109
|
-
FROM sqlite_master
|
110
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
111
|
-
UNION ALL
|
112
|
-
SELECT sql
|
113
|
-
FROM sqlite_temp_master
|
114
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
115
|
-
[0m
|
116
|
-
[1m[35m (0.4ms)[0m SELECT sql
|
117
|
-
FROM sqlite_master
|
118
|
-
WHERE name='index_users_on_email' AND type='index'
|
119
|
-
UNION ALL
|
120
|
-
SELECT sql
|
121
|
-
FROM sqlite_temp_master
|
122
|
-
WHERE name='index_users_on_email' AND type='index'
|
123
|
-
|
124
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
125
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
126
|
-
Migrating to CreatePlans (20150102001930)
|
127
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
128
|
-
[1m[35m (1.2ms)[0m DROP TABLE "plans"
|
129
|
-
[1m[36mSQL (0.2ms)[0m [1mDELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = ?[0m [["version", "20150102001930"]]
|
130
|
-
[1m[35m (0.8ms)[0m commit transaction
|
131
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
132
|
-
[1m[35m (0.1ms)[0m SELECT sql
|
133
|
-
FROM sqlite_master
|
134
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
135
|
-
UNION ALL
|
136
|
-
SELECT sql
|
137
|
-
FROM sqlite_temp_master
|
138
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
139
|
-
|
140
|
-
[1m[36m (0.1ms)[0m [1m SELECT sql
|
141
|
-
FROM sqlite_master
|
142
|
-
WHERE name='index_users_on_email' AND type='index'
|
143
|
-
UNION ALL
|
144
|
-
SELECT sql
|
145
|
-
FROM sqlite_temp_master
|
146
|
-
WHERE name='index_users_on_email' AND type='index'
|
147
|
-
[0m
|
148
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
149
|
-
Migrating to CreatePlans (20150102001930)
|
150
|
-
[1m[35m (0.1ms)[0m begin transaction
|
151
|
-
[1m[36m (0.6ms)[0m [1mCREATE TABLE "plans" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "stripe_id" varchar, "name" varchar, "price_cents" integer, "interval" varchar, "interval_count" integer, "trial_period_days" integer, "metadata_as_json" text, "statement_descriptor" text, "features_as_json" text, "highlight" boolean, "display_order" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
152
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150102001930"]]
|
153
|
-
[1m[36m (0.9ms)[0m [1mcommit transaction[0m
|
154
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
155
|
-
[1m[36m (0.1ms)[0m [1m SELECT sql
|
156
|
-
FROM sqlite_master
|
157
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
158
|
-
UNION ALL
|
159
|
-
SELECT sql
|
160
|
-
FROM sqlite_temp_master
|
161
|
-
WHERE name='index_users_on_reset_password_token' AND type='index'
|
162
|
-
[0m
|
163
|
-
[1m[35m (0.1ms)[0m SELECT sql
|
164
|
-
FROM sqlite_master
|
165
|
-
WHERE name='index_users_on_email' AND type='index'
|
166
|
-
UNION ALL
|
167
|
-
SELECT sql
|
168
|
-
FROM sqlite_temp_master
|
169
|
-
WHERE name='index_users_on_email' AND type='index'
|
170
|
-
|