paid_up 0.10.4 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -2
- data/VERSION +1 -1
- data/app/helpers/paid_up/plans_helper.rb +0 -1
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +280 -109
- data/lib/paid_up/mixins/paid_for.rb +23 -4
- data/lib/paid_up/mixins/subscriber.rb +4 -3
- data/paid_up.gemspec +9 -3
- data/spec/dummy/app/models/group.rb +3 -1
- data/spec/dummy/app/models/post.rb +5 -0
- data/spec/dummy/config/initializers/paid_up.rb +6 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20170219225950_create_posts_table.rb +11 -0
- data/spec/dummy/db/migrate/20170220001913_add_active_column_to_groups.rb +6 -0
- data/spec/dummy/db/schema.rb +69 -55
- data/spec/dummy/db/seeds.rb +80 -7
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/post.rb +7 -0
- data/spec/models/paid_up/feature_spec.rb +10 -2
- data/spec/models/scope_spec.rb +33 -0
- data/spec/models/user_spec.rb +2 -1
- data/spec/support/loaded_site/features.rb +2 -1
- data/spec/support/loaded_site/loaded_site.rb +1 -0
- data/spec/support/loaded_site/posts.rb +7 -0
- metadata +8 -2
@@ -8,7 +8,8 @@ module PaidUp
|
|
8
8
|
PaidUp::Feature.find_by_slug(table_name)
|
9
9
|
end
|
10
10
|
|
11
|
-
def paid_for
|
11
|
+
def paid_for(options = {})
|
12
|
+
my_scope = options[:scope] || :all
|
12
13
|
feature.nil? && raise(
|
13
14
|
:feature_not_found_feature.l(feature: table_name)
|
14
15
|
)
|
@@ -20,6 +21,7 @@ module PaidUp
|
|
20
21
|
attr_accessor :owner
|
21
22
|
when 'table_rows'
|
22
23
|
belongs_to :user
|
24
|
+
User.has_many table_name.to_sym
|
23
25
|
else
|
24
26
|
raise(
|
25
27
|
:value_is_not_a_valid_setting_type.l(
|
@@ -28,8 +30,19 @@ module PaidUp
|
|
28
30
|
)
|
29
31
|
end
|
30
32
|
|
33
|
+
singleton_class.instance_eval do
|
34
|
+
send(:define_method, :paid_for_scope) do
|
35
|
+
send(my_scope)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
31
39
|
send(:define_method, :owners) do
|
32
|
-
|
40
|
+
case self.class.feature.setting_type
|
41
|
+
when 'table_rows'
|
42
|
+
[user]
|
43
|
+
when 'rolify_rows'
|
44
|
+
User.with_role(:owner, self)
|
45
|
+
end
|
33
46
|
end
|
34
47
|
|
35
48
|
send(:define_method, :save_with_owner) do |owner|
|
@@ -41,6 +54,7 @@ module PaidUp
|
|
41
54
|
end
|
42
55
|
end
|
43
56
|
|
57
|
+
# How many records can this user have?
|
44
58
|
send(:define_method, :owners_enabled_count) do
|
45
59
|
setting = 0
|
46
60
|
owners.each do |subscriber|
|
@@ -54,9 +68,14 @@ module PaidUp
|
|
54
68
|
owners.each do |subscriber|
|
55
69
|
case self.class.feature.setting_type
|
56
70
|
when 'table_rows'
|
57
|
-
ids += subscriber.send(self.class.table_name)
|
71
|
+
ids += subscriber.send(self.class.table_name)
|
72
|
+
.send(my_scope)
|
73
|
+
.pluck(:id)
|
58
74
|
when 'rolify_rows'
|
59
|
-
ids += self.class
|
75
|
+
ids += self.class
|
76
|
+
.with_role(:owner, subscriber)
|
77
|
+
.send(my_scope)
|
78
|
+
.pluck(:id)
|
60
79
|
else
|
61
80
|
raise(
|
62
81
|
:no_features_associated_with_table.l(
|
@@ -88,7 +88,8 @@ module PaidUp
|
|
88
88
|
plan.feature_setting table_name
|
89
89
|
end
|
90
90
|
send(:define_method, :table_rows) do |table_name|
|
91
|
-
|
91
|
+
model = table_name.classify.constantize
|
92
|
+
model.paid_for_scope.size
|
92
93
|
end
|
93
94
|
send(:define_method, :rolify_rows_unlimited?) do |table_name|
|
94
95
|
rolify_rows_allowed(table_name) == PaidUp::Unlimited.to_i
|
@@ -100,8 +101,8 @@ module PaidUp
|
|
100
101
|
plan.feature_setting table_name
|
101
102
|
end
|
102
103
|
send(:define_method, :rolify_rows) do |table_name|
|
103
|
-
|
104
|
-
|
104
|
+
model = table_name.classify.constantize
|
105
|
+
model.with_role(:owner, self).paid_for_scope.size
|
105
106
|
end
|
106
107
|
send(:define_method, :plan_stripe_id) do
|
107
108
|
subscription.nil? && return
|
data/paid_up.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: paid_up 0.
|
5
|
+
# stub: paid_up 0.11.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "paid_up"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.11.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Karen Lundgren"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2017-02-20"
|
15
15
|
s.description = "Allows a model of your choosing (such as users) to subscribe to a plan, which enables features."
|
16
16
|
s.email = "karen.e.lundgren@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -96,6 +96,7 @@ Gem::Specification.new do |s|
|
|
96
96
|
"spec/dummy/app/models/ability.rb",
|
97
97
|
"spec/dummy/app/models/doodad.rb",
|
98
98
|
"spec/dummy/app/models/group.rb",
|
99
|
+
"spec/dummy/app/models/post.rb",
|
99
100
|
"spec/dummy/app/models/role.rb",
|
100
101
|
"spec/dummy/app/models/user.rb",
|
101
102
|
"spec/dummy/app/views/layouts/application.html.haml",
|
@@ -141,6 +142,8 @@ Gem::Specification.new do |s|
|
|
141
142
|
"spec/dummy/db/migrate/20160207184113_add_stripe_id_column_to_users.paid_up.rb",
|
142
143
|
"spec/dummy/db/migrate/20160207184114_create_paid_up_plan_feature_settings_table.paid_up.rb",
|
143
144
|
"spec/dummy/db/migrate/20160210165341_add_coupon_code_column_to_users.paid_up.rb",
|
145
|
+
"spec/dummy/db/migrate/20170219225950_create_posts_table.rb",
|
146
|
+
"spec/dummy/db/migrate/20170220001913_add_active_column_to_groups.rb",
|
144
147
|
"spec/dummy/db/schema.rb",
|
145
148
|
"spec/dummy/db/seeds.rb",
|
146
149
|
"spec/dummy/db/test.sqlite3",
|
@@ -162,11 +165,13 @@ Gem::Specification.new do |s|
|
|
162
165
|
"spec/factories/group.rb",
|
163
166
|
"spec/factories/plan.rb",
|
164
167
|
"spec/factories/plan_feature_setting.rb",
|
168
|
+
"spec/factories/post.rb",
|
165
169
|
"spec/factories/user.rb",
|
166
170
|
"spec/models/group_spec.rb",
|
167
171
|
"spec/models/paid_up/feature_spec.rb",
|
168
172
|
"spec/models/paid_up/plan_feature_setting_spec.rb",
|
169
173
|
"spec/models/paid_up/plan_spec.rb",
|
174
|
+
"spec/models/scope_spec.rb",
|
170
175
|
"spec/models/user_spec.rb",
|
171
176
|
"spec/paid_up_spec.rb",
|
172
177
|
"spec/rails_helper.rb",
|
@@ -179,6 +184,7 @@ Gem::Specification.new do |s|
|
|
179
184
|
"spec/support/loaded_site/groups.rb",
|
180
185
|
"spec/support/loaded_site/loaded_site.rb",
|
181
186
|
"spec/support/loaded_site/plans.rb",
|
187
|
+
"spec/support/loaded_site/posts.rb",
|
182
188
|
"spec/support/loaded_site/users.rb",
|
183
189
|
"spec/support/stripe.rb",
|
184
190
|
"spec/views/paid_up/plans_spec.rb",
|
@@ -24,4 +24,10 @@ PaidUp.configure do |config|
|
|
24
24
|
description: 'How many doodads included with this plan?',
|
25
25
|
setting_type: 'table_rows'
|
26
26
|
)
|
27
|
+
PaidUp.add_feature(
|
28
|
+
slug: 'posts',
|
29
|
+
title: 'Posts',
|
30
|
+
description: 'How many posts included with this plan?',
|
31
|
+
setting_type: 'table_rows'
|
32
|
+
)
|
27
33
|
end
|
Binary file
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,79 +11,93 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20170220001913) do
|
15
15
|
|
16
|
-
create_table
|
17
|
-
t.string
|
18
|
-
t.string
|
19
|
-
t.text
|
16
|
+
create_table "doodads", force: :cascade do |t|
|
17
|
+
t.string "user_id"
|
18
|
+
t.string "name"
|
19
|
+
t.text "description"
|
20
20
|
end
|
21
21
|
|
22
|
-
add_index "doodads", [
|
22
|
+
add_index "doodads", ["user_id"], name: "index_doodads_on_user_id"
|
23
23
|
|
24
|
-
create_table
|
25
|
-
t.string
|
26
|
-
t.text
|
27
|
-
t.datetime
|
28
|
-
t.datetime
|
24
|
+
create_table "groups", force: :cascade do |t|
|
25
|
+
t.string "title"
|
26
|
+
t.text "description"
|
27
|
+
t.datetime "created_at"
|
28
|
+
t.datetime "updated_at"
|
29
|
+
t.boolean "active", default: false, null: false
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
t.integer
|
32
|
+
add_index "groups", ["active"], name: "index_groups_on_active"
|
33
|
+
|
34
|
+
create_table "paid_up_plan_feature_settings", force: :cascade do |t|
|
35
|
+
t.integer "paid_up_plan_id"
|
36
|
+
t.string "feature"
|
37
|
+
t.integer "setting"
|
35
38
|
end
|
36
39
|
|
37
|
-
add_index "paid_up_plan_feature_settings", [
|
38
|
-
add_index "paid_up_plan_feature_settings", [
|
40
|
+
add_index "paid_up_plan_feature_settings", ["feature"], name: "index_paid_up_plan_feature_settings_on_feature"
|
41
|
+
add_index "paid_up_plan_feature_settings", ["paid_up_plan_id"], name: "index_paid_up_plan_feature_settings_on_paid_up_plan_id"
|
39
42
|
|
40
|
-
create_table
|
41
|
-
t.string
|
42
|
-
t.string
|
43
|
-
t.text
|
44
|
-
t.integer
|
45
|
-
t.datetime
|
46
|
-
t.datetime
|
43
|
+
create_table "paid_up_plans", force: :cascade do |t|
|
44
|
+
t.string "stripe_id"
|
45
|
+
t.string "title"
|
46
|
+
t.text "description"
|
47
|
+
t.integer "sort_order"
|
48
|
+
t.datetime "created_at"
|
49
|
+
t.datetime "updated_at"
|
47
50
|
end
|
48
51
|
|
49
|
-
add_index "paid_up_plans", ["stripe_id"], name:
|
50
|
-
add_index "paid_up_plans", ["title"], name:
|
52
|
+
add_index "paid_up_plans", ["stripe_id"], name: "index_paid_up_plans_on_stripe_id", unique: true
|
53
|
+
add_index "paid_up_plans", ["title"], name: "index_paid_up_plans_on_title", unique: true
|
51
54
|
|
52
|
-
create_table
|
53
|
-
t.string
|
54
|
-
t.
|
55
|
-
t.
|
56
|
-
t.datetime
|
57
|
-
t.datetime
|
55
|
+
create_table "posts", force: :cascade do |t|
|
56
|
+
t.string "user_id"
|
57
|
+
t.string "title"
|
58
|
+
t.boolean "active", default: false, null: false
|
59
|
+
t.datetime "created_at"
|
60
|
+
t.datetime "updated_at"
|
58
61
|
end
|
59
62
|
|
60
|
-
add_index "
|
61
|
-
add_index "
|
62
|
-
|
63
|
-
create_table
|
64
|
-
t.string
|
65
|
-
t.
|
66
|
-
t.string "
|
67
|
-
t.
|
68
|
-
t.datetime
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
t.string
|
76
|
-
t.string
|
63
|
+
add_index "posts", ["active"], name: "index_posts_on_active"
|
64
|
+
add_index "posts", ["user_id"], name: "index_posts_on_user_id"
|
65
|
+
|
66
|
+
create_table "roles", force: :cascade do |t|
|
67
|
+
t.string "name"
|
68
|
+
t.integer "resource_id"
|
69
|
+
t.string "resource_type"
|
70
|
+
t.datetime "created_at"
|
71
|
+
t.datetime "updated_at"
|
72
|
+
end
|
73
|
+
|
74
|
+
add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id"
|
75
|
+
add_index "roles", ["name"], name: "index_roles_on_name"
|
76
|
+
|
77
|
+
create_table "users", force: :cascade do |t|
|
78
|
+
t.string "name"
|
79
|
+
t.string "email", default: "", null: false
|
80
|
+
t.string "encrypted_password", default: "", null: false
|
81
|
+
t.string "reset_password_token"
|
82
|
+
t.datetime "reset_password_sent_at"
|
83
|
+
t.datetime "remember_created_at"
|
84
|
+
t.integer "sign_in_count", default: 0, null: false
|
85
|
+
t.datetime "current_sign_in_at"
|
86
|
+
t.datetime "last_sign_in_at"
|
87
|
+
t.string "current_sign_in_ip"
|
88
|
+
t.string "last_sign_in_ip"
|
89
|
+
t.string "stripe_id"
|
90
|
+
t.string "coupon_code"
|
77
91
|
end
|
78
92
|
|
79
|
-
add_index "users", ["email"], name:
|
80
|
-
add_index "users", ["reset_password_token"], name:
|
93
|
+
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
94
|
+
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
81
95
|
|
82
|
-
create_table
|
83
|
-
t.integer
|
84
|
-
t.integer
|
96
|
+
create_table "users_roles", id: false, force: :cascade do |t|
|
97
|
+
t.integer "user_id"
|
98
|
+
t.integer "role_id"
|
85
99
|
end
|
86
100
|
|
87
|
-
add_index "users_roles", ["user_id",
|
101
|
+
add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id"
|
88
102
|
|
89
103
|
end
|
data/spec/dummy/db/seeds.rb
CHANGED
@@ -99,12 +99,24 @@ Stripe::Customer.find_or_create_by_id(
|
|
99
99
|
# PlanFeatureSettings #
|
100
100
|
#######################
|
101
101
|
|
102
|
+
# Free
|
103
|
+
PaidUp::PlanFeatureSetting.create(
|
104
|
+
feature: 'posts',
|
105
|
+
plan: free_plan,
|
106
|
+
setting: 3
|
107
|
+
)
|
108
|
+
|
102
109
|
# Ad Free
|
103
110
|
PaidUp::PlanFeatureSetting.create(
|
104
111
|
feature: 'ad_free',
|
105
112
|
plan: no_ads_plan,
|
106
113
|
setting: 1
|
107
114
|
)
|
115
|
+
PaidUp::PlanFeatureSetting.create(
|
116
|
+
feature: 'posts',
|
117
|
+
plan: no_ads_plan,
|
118
|
+
setting: 5
|
119
|
+
)
|
108
120
|
|
109
121
|
# Group Leader
|
110
122
|
PaidUp::PlanFeatureSetting.create(
|
@@ -122,6 +134,11 @@ PaidUp::PlanFeatureSetting.create(
|
|
122
134
|
plan: group_leader_plan,
|
123
135
|
setting: 10
|
124
136
|
)
|
137
|
+
PaidUp::PlanFeatureSetting.create(
|
138
|
+
feature: 'posts',
|
139
|
+
plan: group_leader_plan,
|
140
|
+
setting: 10
|
141
|
+
)
|
125
142
|
|
126
143
|
# Professional
|
127
144
|
PaidUp::PlanFeatureSetting.create(
|
@@ -139,12 +156,17 @@ PaidUp::PlanFeatureSetting.create(
|
|
139
156
|
plan: professional_plan,
|
140
157
|
setting: PaidUp::Unlimited.to_i(:db)
|
141
158
|
)
|
159
|
+
PaidUp::PlanFeatureSetting.create(
|
160
|
+
feature: 'posts',
|
161
|
+
plan: professional_plan,
|
162
|
+
setting: 25
|
163
|
+
)
|
142
164
|
|
143
165
|
###############
|
144
166
|
# Users #
|
145
167
|
###############
|
146
168
|
|
147
|
-
FactoryGirl.create(
|
169
|
+
free_subscriber = FactoryGirl.create(
|
148
170
|
:user,
|
149
171
|
name: 'Free Subscriber',
|
150
172
|
plan: free_plan
|
@@ -194,33 +216,84 @@ past_due_subscriber = FactoryGirl.create(
|
|
194
216
|
FactoryGirl.create(
|
195
217
|
:group,
|
196
218
|
title: 'First Group',
|
197
|
-
owner: group_leader_subscriber
|
219
|
+
owner: group_leader_subscriber,
|
220
|
+
active: true
|
221
|
+
)
|
222
|
+
|
223
|
+
FactoryGirl.create(
|
224
|
+
:group,
|
225
|
+
title: 'Inactive Group',
|
226
|
+
owner: group_leader_subscriber,
|
227
|
+
active: false
|
198
228
|
)
|
199
229
|
|
200
230
|
FactoryGirl.create(
|
201
231
|
:group,
|
202
232
|
title: 'Second Group',
|
203
|
-
owner: professional_subscriber
|
233
|
+
owner: professional_subscriber,
|
234
|
+
active: true
|
204
235
|
)
|
205
236
|
|
206
237
|
FactoryGirl.create(
|
207
238
|
:group,
|
208
239
|
title: 'Third Group',
|
209
|
-
owner: professional_subscriber
|
240
|
+
owner: professional_subscriber,
|
241
|
+
active: true
|
210
242
|
)
|
211
243
|
|
212
244
|
5.times do
|
213
|
-
FactoryGirl.create(:group, owner: disabling_subscriber)
|
245
|
+
FactoryGirl.create(:group, owner: disabling_subscriber, active: true)
|
214
246
|
end
|
215
247
|
|
216
248
|
FactoryGirl.create(
|
217
249
|
:group,
|
218
250
|
title: 'Disabled Group',
|
219
|
-
owner: disabling_subscriber
|
251
|
+
owner: disabling_subscriber,
|
252
|
+
active: true
|
220
253
|
)
|
221
254
|
|
222
255
|
FactoryGirl.create(
|
223
256
|
:group,
|
224
257
|
title: 'Past Due Group',
|
225
|
-
owner: past_due_subscriber
|
258
|
+
owner: past_due_subscriber,
|
259
|
+
active: true
|
260
|
+
)
|
261
|
+
|
262
|
+
###############
|
263
|
+
# Posts #
|
264
|
+
###############
|
265
|
+
|
266
|
+
FactoryGirl.create(
|
267
|
+
:post,
|
268
|
+
title: 'First Post',
|
269
|
+
user: free_subscriber,
|
270
|
+
active: true
|
271
|
+
)
|
272
|
+
|
273
|
+
FactoryGirl.create(
|
274
|
+
:post,
|
275
|
+
title: 'Active Post',
|
276
|
+
user: free_subscriber,
|
277
|
+
active: true
|
278
|
+
)
|
279
|
+
|
280
|
+
FactoryGirl.create(
|
281
|
+
:post,
|
282
|
+
title: 'Inactive Post',
|
283
|
+
user: free_subscriber,
|
284
|
+
active: false
|
285
|
+
)
|
286
|
+
|
287
|
+
FactoryGirl.create(
|
288
|
+
:post,
|
289
|
+
title: 'Still Enabled Post',
|
290
|
+
user: free_subscriber,
|
291
|
+
active: true
|
292
|
+
)
|
293
|
+
|
294
|
+
FactoryGirl.create(
|
295
|
+
:post,
|
296
|
+
title: 'No Longer Enabled Post',
|
297
|
+
user: free_subscriber,
|
298
|
+
active: true
|
226
299
|
)
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -31,7 +31,8 @@ describe PaidUp::Feature do
|
|
31
31
|
eq(
|
32
32
|
ad_free: ad_free_feature,
|
33
33
|
groups: groups_feature,
|
34
|
-
doodads: doodads_feature
|
34
|
+
doodads: doodads_feature,
|
35
|
+
posts: posts_feature
|
35
36
|
)
|
36
37
|
)
|
37
38
|
end
|
@@ -39,7 +40,14 @@ describe PaidUp::Feature do
|
|
39
40
|
|
40
41
|
context '.all' do
|
41
42
|
subject { PaidUp::Feature.all }
|
42
|
-
it
|
43
|
+
it do
|
44
|
+
should eq [
|
45
|
+
ad_free_feature,
|
46
|
+
groups_feature,
|
47
|
+
doodads_feature,
|
48
|
+
posts_feature
|
49
|
+
]
|
50
|
+
end
|
43
51
|
end
|
44
52
|
|
45
53
|
context '.find_all' do
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
require 'cancan/matchers'
|
3
|
+
|
4
|
+
describe 'Scopes' do
|
5
|
+
include_context 'loaded site'
|
6
|
+
|
7
|
+
describe 'paid_for#owners_records' do
|
8
|
+
subject { first_post.owners_records }
|
9
|
+
it { should include active_post }
|
10
|
+
it { should_not include inactive_post }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'paid_for#enabled' do
|
14
|
+
describe 'when it is within the limit' do
|
15
|
+
subject { still_enabled_post.enabled }
|
16
|
+
it { should be true }
|
17
|
+
end
|
18
|
+
describe 'when it is NOT within the limit' do
|
19
|
+
subject { no_longer_enabled_post.enabled }
|
20
|
+
it { should be false }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'user#table_rows' do
|
25
|
+
subject { free_subscriber.table_rows('posts') }
|
26
|
+
it { should eq 4 }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'user#rolify_rows' do
|
30
|
+
subject { group_leader_subscriber.rolify_rows('groups') }
|
31
|
+
it { should eq 1 }
|
32
|
+
end
|
33
|
+
end
|
data/spec/models/user_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
shared_context 'features' do
|
2
2
|
let!(:ad_free_feature) { PaidUp::Feature.find_by_slug('ad_free') }
|
3
3
|
let!(:groups_feature) { PaidUp::Feature.find_by_slug('groups') }
|
4
|
-
let!(:doodads_feature) { PaidUp::Feature.find_by_slug('doodads') }
|
4
|
+
let!(:doodads_feature) { PaidUp::Feature.find_by_slug('doodads') }
|
5
|
+
let!(:posts_feature) { PaidUp::Feature.find_by_slug('posts') }
|
5
6
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
shared_context 'posts' do
|
2
|
+
let(:first_post) { Post.find_by_title('First Post') }
|
3
|
+
let(:active_post) { Post.find_by_title('Active Post') }
|
4
|
+
let(:inactive_post) { Post.find_by_title('Inactive Post') }
|
5
|
+
let(:still_enabled_post) { Post.find_by_title('Still Enabled Post') }
|
6
|
+
let(:no_longer_enabled_post) { Post.find_by_title('No Longer Enabled Post') }
|
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.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karen Lundgren
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -460,6 +460,7 @@ files:
|
|
460
460
|
- spec/dummy/app/models/ability.rb
|
461
461
|
- spec/dummy/app/models/doodad.rb
|
462
462
|
- spec/dummy/app/models/group.rb
|
463
|
+
- spec/dummy/app/models/post.rb
|
463
464
|
- spec/dummy/app/models/role.rb
|
464
465
|
- spec/dummy/app/models/user.rb
|
465
466
|
- spec/dummy/app/views/layouts/application.html.haml
|
@@ -505,6 +506,8 @@ files:
|
|
505
506
|
- spec/dummy/db/migrate/20160207184113_add_stripe_id_column_to_users.paid_up.rb
|
506
507
|
- spec/dummy/db/migrate/20160207184114_create_paid_up_plan_feature_settings_table.paid_up.rb
|
507
508
|
- spec/dummy/db/migrate/20160210165341_add_coupon_code_column_to_users.paid_up.rb
|
509
|
+
- spec/dummy/db/migrate/20170219225950_create_posts_table.rb
|
510
|
+
- spec/dummy/db/migrate/20170220001913_add_active_column_to_groups.rb
|
508
511
|
- spec/dummy/db/schema.rb
|
509
512
|
- spec/dummy/db/seeds.rb
|
510
513
|
- spec/dummy/db/test.sqlite3
|
@@ -526,11 +529,13 @@ files:
|
|
526
529
|
- spec/factories/group.rb
|
527
530
|
- spec/factories/plan.rb
|
528
531
|
- spec/factories/plan_feature_setting.rb
|
532
|
+
- spec/factories/post.rb
|
529
533
|
- spec/factories/user.rb
|
530
534
|
- spec/models/group_spec.rb
|
531
535
|
- spec/models/paid_up/feature_spec.rb
|
532
536
|
- spec/models/paid_up/plan_feature_setting_spec.rb
|
533
537
|
- spec/models/paid_up/plan_spec.rb
|
538
|
+
- spec/models/scope_spec.rb
|
534
539
|
- spec/models/user_spec.rb
|
535
540
|
- spec/paid_up_spec.rb
|
536
541
|
- spec/rails_helper.rb
|
@@ -543,6 +548,7 @@ files:
|
|
543
548
|
- spec/support/loaded_site/groups.rb
|
544
549
|
- spec/support/loaded_site/loaded_site.rb
|
545
550
|
- spec/support/loaded_site/plans.rb
|
551
|
+
- spec/support/loaded_site/posts.rb
|
546
552
|
- spec/support/loaded_site/users.rb
|
547
553
|
- spec/support/stripe.rb
|
548
554
|
- spec/views/paid_up/plans_spec.rb
|