paid_up 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +3 -0
  4. data/Gemfile +46 -0
  5. data/LICENSE.txt +20 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.md +64 -0
  8. data/Rakefile +48 -0
  9. data/VERSION +1 -0
  10. data/app/controllers/paid_up/paid_up_controller.rb +12 -0
  11. data/app/controllers/paid_up/plans_controller.rb +7 -0
  12. data/app/controllers/paid_up/subscriptions_controller.rb +37 -0
  13. data/app/helpers/paid_up/features_helper.rb +65 -0
  14. data/app/helpers/paid_up/paid_up_helper.rb +14 -0
  15. data/app/helpers/paid_up/plans_helper.rb +53 -0
  16. data/app/helpers/paid_up/subscriptions_helper.rb +21 -0
  17. data/app/models/ability.rb +37 -0
  18. data/app/models/paid_up/feature.rb +19 -0
  19. data/app/models/paid_up/features_plan.rb +14 -0
  20. data/app/models/paid_up/plan.rb +99 -0
  21. data/app/views/devise/confirmations/new.html.haml +13 -0
  22. data/app/views/devise/passwords/edit.html.haml +19 -0
  23. data/app/views/devise/passwords/new.html.haml +14 -0
  24. data/app/views/devise/registrations/_new_form.html.haml +23 -0
  25. data/app/views/devise/registrations/edit.html.haml +39 -0
  26. data/app/views/devise/registrations/new.html.haml +11 -0
  27. data/app/views/devise/sessions/_new_form.html.haml +21 -0
  28. data/app/views/devise/sessions/new.html.haml +11 -0
  29. data/app/views/devise/shared/_links.html.haml +14 -0
  30. data/app/views/devise/unlocks/new.html.haml +14 -0
  31. data/app/views/paid_up/features/_abilities_table.html.haml +22 -0
  32. data/app/views/paid_up/features/_table.html.haml +16 -0
  33. data/app/views/paid_up/plans/index.html.haml +18 -0
  34. data/app/views/paid_up/subscriptions/index.html.haml +16 -0
  35. data/app/views/paid_up/subscriptions/new.html.haml +101 -0
  36. data/bin/rails +12 -0
  37. data/config/initializers/stripe.rb +6 -0
  38. data/config/locales/en.yml +85 -0
  39. data/config/routes.rb +7 -0
  40. data/coverage/.last_run.json +5 -0
  41. data/coverage/.resultset.json +1488 -0
  42. data/coverage/.resultset.json.lock +0 -0
  43. data/db/migrate/20150407105900_create_paid_up_features_plans_table.rb +9 -0
  44. data/db/migrate/20150407110100_create_paid_up_features_table.rb +11 -0
  45. data/db/migrate/20150407110101_create_paid_up_plans_table.rb +14 -0
  46. data/lib/generators/paid_up/install/install_generator.rb +59 -0
  47. data/lib/generators/paid_up/install/templates/initializer.rb.erb +5 -0
  48. data/lib/generators/paid_up/utils.rb +16 -0
  49. data/lib/paid_up/configuration.rb +22 -0
  50. data/lib/paid_up/engine.rb +17 -0
  51. data/lib/paid_up/integer.rb +9 -0
  52. data/lib/paid_up/localization.rb +31 -0
  53. data/lib/paid_up/mixins.rb +139 -0
  54. data/lib/paid_up/railtie.rb +4 -0
  55. data/lib/paid_up/stripe_extensions.rb +17 -0
  56. data/lib/paid_up/table_validator.rb +9 -0
  57. data/lib/paid_up/unlimited.rb +17 -0
  58. data/lib/paid_up/version.rb +7 -0
  59. data/lib/paid_up.rb +27 -0
  60. data/paid_up.gemspec +248 -0
  61. data/spec/controllers/paid_up/plans_spec.rb +26 -0
  62. data/spec/controllers/paid_up/subscriptions_spec.rb +187 -0
  63. data/spec/dummy/README.rdoc +28 -0
  64. data/spec/dummy/Rakefile +6 -0
  65. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  66. data/spec/dummy/app/assets/stylesheets/application.css.scss +16 -0
  67. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  68. data/spec/dummy/app/models/group.rb +3 -0
  69. data/spec/dummy/app/models/user.rb +9 -0
  70. data/spec/dummy/app/views/layouts/application.html.haml +31 -0
  71. data/spec/dummy/app/views/pages/index.html.haml +1 -0
  72. data/spec/dummy/bin/bundle +3 -0
  73. data/spec/dummy/bin/rails +4 -0
  74. data/spec/dummy/bin/rake +4 -0
  75. data/spec/dummy/bin/setup +29 -0
  76. data/spec/dummy/config/application.rb +32 -0
  77. data/spec/dummy/config/boot.rb +5 -0
  78. data/spec/dummy/config/database.yml +25 -0
  79. data/spec/dummy/config/environment.rb +5 -0
  80. data/spec/dummy/config/environments/development.rb +46 -0
  81. data/spec/dummy/config/environments/production.rb +79 -0
  82. data/spec/dummy/config/environments/test.rb +45 -0
  83. data/spec/dummy/config/initializers/assets.rb +11 -0
  84. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  85. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  86. data/spec/dummy/config/initializers/devise.rb +259 -0
  87. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  88. data/spec/dummy/config/initializers/high_voltage.rb +3 -0
  89. data/spec/dummy/config/initializers/inflections.rb +16 -0
  90. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  91. data/spec/dummy/config/initializers/paid_up.rb +5 -0
  92. data/spec/dummy/config/initializers/session_store.rb +3 -0
  93. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  94. data/spec/dummy/config/locales/devise.en.yml +60 -0
  95. data/spec/dummy/config/locales/en.yml +23 -0
  96. data/spec/dummy/config/routes.rb +4 -0
  97. data/spec/dummy/config/secrets.yml +22 -0
  98. data/spec/dummy/config.ru +4 -0
  99. data/spec/dummy/db/development.sqlite3 +0 -0
  100. data/spec/dummy/db/migrate/20150406154440_create_users_table.rb +7 -0
  101. data/spec/dummy/db/migrate/20150517175135_create_groups_table.rb +11 -0
  102. data/spec/dummy/db/migrate/20150518000915_add_devise_to_users.rb +49 -0
  103. data/spec/dummy/db/migrate/20150518000917_create_paid_up_features_plans_table.paid_up.rb +10 -0
  104. data/spec/dummy/db/migrate/20150518000918_create_paid_up_features_table.paid_up.rb +12 -0
  105. data/spec/dummy/db/migrate/20150518000919_create_paid_up_plans_table.paid_up.rb +15 -0
  106. data/spec/dummy/db/migrate/20150518000920_add_stripe_id_column_to_user.rb +6 -0
  107. data/spec/dummy/db/schema.rb +75 -0
  108. data/spec/dummy/db/seeds/features.seeds.rb +19 -0
  109. data/spec/dummy/db/seeds/features_plans.seeds.rb +51 -0
  110. data/spec/dummy/db/seeds/plans.seeds.rb +91 -0
  111. data/spec/dummy/db/seeds.rb +0 -0
  112. data/spec/dummy/db/test.sqlite3 +0 -0
  113. data/spec/dummy/lib/assets/.keep +0 -0
  114. data/spec/dummy/log/.keep +0 -0
  115. data/spec/dummy/log/development.log +108393 -0
  116. data/spec/dummy/public/404.html +67 -0
  117. data/spec/dummy/public/422.html +67 -0
  118. data/spec/dummy/public/500.html +66 -0
  119. data/spec/dummy/public/assets/.sprockets-manifest-34b01376fc56586f4f4fd19e7b1c0e35.json +1 -0
  120. data/spec/dummy/public/assets/application-27f004bb902952dbbaad25f0f28c312f29ffee315c94fa51dea6b5ec6dc993e6.css +13 -0
  121. data/spec/dummy/public/assets/application-3a226fbacd7ba9a2b9f7972fafdd7b2486c34707d96a60c26f3bbe4579c29ca6.js +116 -0
  122. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot +0 -0
  123. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg +288 -0
  124. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742.woff +0 -0
  125. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf +0 -0
  126. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c.woff2 +0 -0
  127. data/spec/dummy/public/favicon.ico +0 -0
  128. data/spec/dummy/test/controllers/plans_controller_controller_test.rb +7 -0
  129. data/spec/factories/feature.rb +7 -0
  130. data/spec/factories/features_plan.rb +7 -0
  131. data/spec/factories/plan.rb +7 -0
  132. data/spec/factories/user.rb +7 -0
  133. data/spec/models/paid_up/feature_spec.rb +21 -0
  134. data/spec/models/paid_up/features_plan_spec.rb +7 -0
  135. data/spec/models/paid_up/plan_spec.rb +156 -0
  136. data/spec/models/user_spec.rb +304 -0
  137. data/spec/paid_up_spec.rb +7 -0
  138. data/spec/rails_helper.rb +65 -0
  139. data/spec/routing/paid_up/plans_spec.rb +11 -0
  140. data/spec/routing/paid_up/subscription_spec.rb +23 -0
  141. data/spec/spec_helper.rb +87 -0
  142. data/spec/support/controller_macros.rb +12 -0
  143. data/spec/support/factory_girl.rb +3 -0
  144. data/spec/support/plans_and_features.rb +209 -0
  145. data/spec/support/stripe.rb +23 -0
  146. data/spec/support/subscribers.rb +44 -0
  147. data/spec/views/paid_up/plans_spec.rb +54 -0
  148. data/spec/views/paid_up/subscriptions_spec.rb +58 -0
  149. metadata +488 -0
data/paid_up.gemspec ADDED
@@ -0,0 +1,248 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: paid_up 0.1.0 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "paid_up"
9
+ s.version = "0.1.0"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["Karen Lundgren"]
14
+ s.date = "2015-05-19"
15
+ s.description = "Allows a model of your choosing (such as users) to subscribe to a plan, which enables features."
16
+ s.email = "karen.e.lundgren@gmail.com"
17
+ s.executables = ["rails"]
18
+ s.extra_rdoc_files = [
19
+ "LICENSE.txt",
20
+ "README.md"
21
+ ]
22
+ s.files = [
23
+ ".rspec",
24
+ ".travis.yml",
25
+ "Gemfile",
26
+ "LICENSE.txt",
27
+ "MIT-LICENSE",
28
+ "README.md",
29
+ "Rakefile",
30
+ "VERSION",
31
+ "app/controllers/paid_up/paid_up_controller.rb",
32
+ "app/controllers/paid_up/plans_controller.rb",
33
+ "app/controllers/paid_up/subscriptions_controller.rb",
34
+ "app/helpers/paid_up/features_helper.rb",
35
+ "app/helpers/paid_up/paid_up_helper.rb",
36
+ "app/helpers/paid_up/plans_helper.rb",
37
+ "app/helpers/paid_up/subscriptions_helper.rb",
38
+ "app/models/ability.rb",
39
+ "app/models/paid_up/feature.rb",
40
+ "app/models/paid_up/features_plan.rb",
41
+ "app/models/paid_up/plan.rb",
42
+ "app/views/devise/confirmations/new.html.haml",
43
+ "app/views/devise/passwords/edit.html.haml",
44
+ "app/views/devise/passwords/new.html.haml",
45
+ "app/views/devise/registrations/_new_form.html.haml",
46
+ "app/views/devise/registrations/edit.html.haml",
47
+ "app/views/devise/registrations/new.html.haml",
48
+ "app/views/devise/sessions/_new_form.html.haml",
49
+ "app/views/devise/sessions/new.html.haml",
50
+ "app/views/devise/shared/_links.html.haml",
51
+ "app/views/devise/unlocks/new.html.haml",
52
+ "app/views/paid_up/features/_abilities_table.html.haml",
53
+ "app/views/paid_up/features/_table.html.haml",
54
+ "app/views/paid_up/plans/index.html.haml",
55
+ "app/views/paid_up/subscriptions/index.html.haml",
56
+ "app/views/paid_up/subscriptions/new.html.haml",
57
+ "bin/rails",
58
+ "config/initializers/stripe.rb",
59
+ "config/locales/en.yml",
60
+ "config/routes.rb",
61
+ "coverage/.last_run.json",
62
+ "coverage/.resultset.json",
63
+ "coverage/.resultset.json.lock",
64
+ "db/migrate/20150407105900_create_paid_up_features_plans_table.rb",
65
+ "db/migrate/20150407110100_create_paid_up_features_table.rb",
66
+ "db/migrate/20150407110101_create_paid_up_plans_table.rb",
67
+ "lib/generators/paid_up/install/install_generator.rb",
68
+ "lib/generators/paid_up/install/templates/initializer.rb.erb",
69
+ "lib/generators/paid_up/utils.rb",
70
+ "lib/paid_up.rb",
71
+ "lib/paid_up/configuration.rb",
72
+ "lib/paid_up/engine.rb",
73
+ "lib/paid_up/integer.rb",
74
+ "lib/paid_up/localization.rb",
75
+ "lib/paid_up/mixins.rb",
76
+ "lib/paid_up/railtie.rb",
77
+ "lib/paid_up/stripe_extensions.rb",
78
+ "lib/paid_up/table_validator.rb",
79
+ "lib/paid_up/unlimited.rb",
80
+ "lib/paid_up/version.rb",
81
+ "paid_up.gemspec",
82
+ "spec/controllers/paid_up/plans_spec.rb",
83
+ "spec/controllers/paid_up/subscriptions_spec.rb",
84
+ "spec/dummy/README.rdoc",
85
+ "spec/dummy/Rakefile",
86
+ "spec/dummy/app/assets/javascripts/application.js",
87
+ "spec/dummy/app/assets/stylesheets/application.css.scss",
88
+ "spec/dummy/app/controllers/application_controller.rb",
89
+ "spec/dummy/app/models/group.rb",
90
+ "spec/dummy/app/models/user.rb",
91
+ "spec/dummy/app/views/layouts/application.html.haml",
92
+ "spec/dummy/app/views/pages/index.html.haml",
93
+ "spec/dummy/bin/bundle",
94
+ "spec/dummy/bin/rails",
95
+ "spec/dummy/bin/rake",
96
+ "spec/dummy/bin/setup",
97
+ "spec/dummy/config.ru",
98
+ "spec/dummy/config/application.rb",
99
+ "spec/dummy/config/boot.rb",
100
+ "spec/dummy/config/database.yml",
101
+ "spec/dummy/config/environment.rb",
102
+ "spec/dummy/config/environments/development.rb",
103
+ "spec/dummy/config/environments/production.rb",
104
+ "spec/dummy/config/environments/test.rb",
105
+ "spec/dummy/config/initializers/assets.rb",
106
+ "spec/dummy/config/initializers/backtrace_silencers.rb",
107
+ "spec/dummy/config/initializers/cookies_serializer.rb",
108
+ "spec/dummy/config/initializers/devise.rb",
109
+ "spec/dummy/config/initializers/filter_parameter_logging.rb",
110
+ "spec/dummy/config/initializers/high_voltage.rb",
111
+ "spec/dummy/config/initializers/inflections.rb",
112
+ "spec/dummy/config/initializers/mime_types.rb",
113
+ "spec/dummy/config/initializers/paid_up.rb",
114
+ "spec/dummy/config/initializers/session_store.rb",
115
+ "spec/dummy/config/initializers/wrap_parameters.rb",
116
+ "spec/dummy/config/locales/devise.en.yml",
117
+ "spec/dummy/config/locales/en.yml",
118
+ "spec/dummy/config/routes.rb",
119
+ "spec/dummy/config/secrets.yml",
120
+ "spec/dummy/db/development.sqlite3",
121
+ "spec/dummy/db/migrate/20150406154440_create_users_table.rb",
122
+ "spec/dummy/db/migrate/20150517175135_create_groups_table.rb",
123
+ "spec/dummy/db/migrate/20150518000915_add_devise_to_users.rb",
124
+ "spec/dummy/db/migrate/20150518000917_create_paid_up_features_plans_table.paid_up.rb",
125
+ "spec/dummy/db/migrate/20150518000918_create_paid_up_features_table.paid_up.rb",
126
+ "spec/dummy/db/migrate/20150518000919_create_paid_up_plans_table.paid_up.rb",
127
+ "spec/dummy/db/migrate/20150518000920_add_stripe_id_column_to_user.rb",
128
+ "spec/dummy/db/schema.rb",
129
+ "spec/dummy/db/seeds.rb",
130
+ "spec/dummy/db/seeds/features.seeds.rb",
131
+ "spec/dummy/db/seeds/features_plans.seeds.rb",
132
+ "spec/dummy/db/seeds/plans.seeds.rb",
133
+ "spec/dummy/db/test.sqlite3",
134
+ "spec/dummy/lib/assets/.keep",
135
+ "spec/dummy/log/.keep",
136
+ "spec/dummy/log/development.log",
137
+ "spec/dummy/public/404.html",
138
+ "spec/dummy/public/422.html",
139
+ "spec/dummy/public/500.html",
140
+ "spec/dummy/public/assets/.sprockets-manifest-34b01376fc56586f4f4fd19e7b1c0e35.json",
141
+ "spec/dummy/public/assets/application-27f004bb902952dbbaad25f0f28c312f29ffee315c94fa51dea6b5ec6dc993e6.css",
142
+ "spec/dummy/public/assets/application-3a226fbacd7ba9a2b9f7972fafdd7b2486c34707d96a60c26f3bbe4579c29ca6.js",
143
+ "spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot",
144
+ "spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg",
145
+ "spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742.woff",
146
+ "spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf",
147
+ "spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c.woff2",
148
+ "spec/dummy/public/favicon.ico",
149
+ "spec/dummy/test/controllers/plans_controller_controller_test.rb",
150
+ "spec/factories/feature.rb",
151
+ "spec/factories/features_plan.rb",
152
+ "spec/factories/plan.rb",
153
+ "spec/factories/user.rb",
154
+ "spec/models/paid_up/feature_spec.rb",
155
+ "spec/models/paid_up/features_plan_spec.rb",
156
+ "spec/models/paid_up/plan_spec.rb",
157
+ "spec/models/user_spec.rb",
158
+ "spec/paid_up_spec.rb",
159
+ "spec/rails_helper.rb",
160
+ "spec/routing/paid_up/plans_spec.rb",
161
+ "spec/routing/paid_up/subscription_spec.rb",
162
+ "spec/spec_helper.rb",
163
+ "spec/support/controller_macros.rb",
164
+ "spec/support/factory_girl.rb",
165
+ "spec/support/plans_and_features.rb",
166
+ "spec/support/stripe.rb",
167
+ "spec/support/subscribers.rb",
168
+ "spec/views/paid_up/plans_spec.rb",
169
+ "spec/views/paid_up/subscriptions_spec.rb"
170
+ ]
171
+ s.homepage = "http://www.gemvein.com/museum/cases/paid_up"
172
+ s.licenses = ["MIT"]
173
+ s.rubygems_version = "2.4.6"
174
+ s.summary = "Allows a model of your choosing to subscribe to a plan, which enables features."
175
+
176
+ if s.respond_to? :specification_version then
177
+ s.specification_version = 4
178
+
179
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
180
+ s.add_runtime_dependency(%q<rails>, [">= 4.2"])
181
+ s.add_runtime_dependency(%q<rails-i18n>, [">= 0"])
182
+ s.add_runtime_dependency(%q<haml-rails>, [">= 0"])
183
+ s.add_runtime_dependency(%q<jquery-rails>, [">= 0"])
184
+ s.add_runtime_dependency(%q<uglifier>, [">= 0"])
185
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
186
+ s.add_runtime_dependency(%q<bootstrap_leather>, [">= 0"])
187
+ s.add_runtime_dependency(%q<seedbank>, [">= 0"])
188
+ s.add_runtime_dependency(%q<chronic>, [">= 0"])
189
+ s.add_runtime_dependency(%q<money>, [">= 0"])
190
+ s.add_runtime_dependency(%q<devise>, [">= 0"])
191
+ s.add_runtime_dependency(%q<cancan>, [">= 0"])
192
+ s.add_runtime_dependency(%q<stripe>, [">= 0"])
193
+ s.add_development_dependency(%q<rspec-rails>, [">= 0"])
194
+ s.add_development_dependency(%q<rspec-collection_matchers>, [">= 0"])
195
+ s.add_development_dependency(%q<database_cleaner>, [">= 0"])
196
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
197
+ s.add_development_dependency(%q<high_voltage>, [">= 0"])
198
+ s.add_development_dependency(%q<forgery>, [">= 0"])
199
+ s.add_development_dependency(%q<bootstrap-sass>, ["~> 3.3.4"])
200
+ s.add_development_dependency(%q<sass-rails>, [">= 3.2"])
201
+ else
202
+ s.add_dependency(%q<rails>, [">= 4.2"])
203
+ s.add_dependency(%q<rails-i18n>, [">= 0"])
204
+ s.add_dependency(%q<haml-rails>, [">= 0"])
205
+ s.add_dependency(%q<jquery-rails>, [">= 0"])
206
+ s.add_dependency(%q<uglifier>, [">= 0"])
207
+ s.add_dependency(%q<jeweler>, [">= 0"])
208
+ s.add_dependency(%q<bootstrap_leather>, [">= 0"])
209
+ s.add_dependency(%q<seedbank>, [">= 0"])
210
+ s.add_dependency(%q<chronic>, [">= 0"])
211
+ s.add_dependency(%q<money>, [">= 0"])
212
+ s.add_dependency(%q<devise>, [">= 0"])
213
+ s.add_dependency(%q<cancan>, [">= 0"])
214
+ s.add_dependency(%q<stripe>, [">= 0"])
215
+ s.add_dependency(%q<rspec-rails>, [">= 0"])
216
+ s.add_dependency(%q<rspec-collection_matchers>, [">= 0"])
217
+ s.add_dependency(%q<database_cleaner>, [">= 0"])
218
+ s.add_dependency(%q<sqlite3>, [">= 0"])
219
+ s.add_dependency(%q<high_voltage>, [">= 0"])
220
+ s.add_dependency(%q<forgery>, [">= 0"])
221
+ s.add_dependency(%q<bootstrap-sass>, ["~> 3.3.4"])
222
+ s.add_dependency(%q<sass-rails>, [">= 3.2"])
223
+ end
224
+ else
225
+ s.add_dependency(%q<rails>, [">= 4.2"])
226
+ s.add_dependency(%q<rails-i18n>, [">= 0"])
227
+ s.add_dependency(%q<haml-rails>, [">= 0"])
228
+ s.add_dependency(%q<jquery-rails>, [">= 0"])
229
+ s.add_dependency(%q<uglifier>, [">= 0"])
230
+ s.add_dependency(%q<jeweler>, [">= 0"])
231
+ s.add_dependency(%q<bootstrap_leather>, [">= 0"])
232
+ s.add_dependency(%q<seedbank>, [">= 0"])
233
+ s.add_dependency(%q<chronic>, [">= 0"])
234
+ s.add_dependency(%q<money>, [">= 0"])
235
+ s.add_dependency(%q<devise>, [">= 0"])
236
+ s.add_dependency(%q<cancan>, [">= 0"])
237
+ s.add_dependency(%q<stripe>, [">= 0"])
238
+ s.add_dependency(%q<rspec-rails>, [">= 0"])
239
+ s.add_dependency(%q<rspec-collection_matchers>, [">= 0"])
240
+ s.add_dependency(%q<database_cleaner>, [">= 0"])
241
+ s.add_dependency(%q<sqlite3>, [">= 0"])
242
+ s.add_dependency(%q<high_voltage>, [">= 0"])
243
+ s.add_dependency(%q<forgery>, [">= 0"])
244
+ s.add_dependency(%q<bootstrap-sass>, ["~> 3.3.4"])
245
+ s.add_dependency(%q<sass-rails>, [">= 3.2"])
246
+ end
247
+ end
248
+
@@ -0,0 +1,26 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe PaidUp::PlansController do
4
+ include_context 'plans and features'
5
+ routes { PaidUp::Engine.routes }
6
+
7
+ describe "GET #index" do
8
+ before :each do
9
+ get :index
10
+ end
11
+ context "responds successfully with an HTTP 200 status code" do
12
+ subject { response }
13
+ it { should be_success }
14
+ it { should have_http_status(200) }
15
+ end
16
+ context "renders the index template" do
17
+ subject { response }
18
+ it { should render_template("index") }
19
+ end
20
+ context "loads all of the plans into @plans" do
21
+ subject { assigns(:plans) }
22
+ it { should eq(PaidUp::Plan.subscribable) }
23
+ it { should have(4).items }
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,187 @@
1
+ require 'rails_helper'
2
+
3
+
4
+ RSpec.describe PaidUp::SubscriptionsController do
5
+ include_context 'plans and features'
6
+ routes { PaidUp::Engine.routes }
7
+
8
+ describe 'GET #index' do
9
+ context 'when the user is anonymous' do
10
+ before :each do
11
+ access_anonymous
12
+ get :index
13
+ end
14
+ context 'redirects to the user sign up page' do
15
+ subject { response }
16
+ it { should redirect_to '/users/sign_in' }
17
+ it { should have_http_status(302) }
18
+ end
19
+ end
20
+ context 'when the user is signed in as a subscriber' do
21
+ include_context 'subscribers'
22
+ before :each do
23
+ sign_in free_subscriber
24
+ get :index
25
+ end
26
+ context "responds successfully with an HTTP 200 status code" do
27
+ subject { response }
28
+ it { should be_success }
29
+ it { should have_http_status(200) }
30
+ end
31
+ context "renders the index template" do
32
+ subject { response }
33
+ it { should render_template("index") }
34
+ end
35
+ end
36
+ end
37
+
38
+ describe "GET #new" do
39
+ context "when the user is anonymous" do
40
+ before :each do
41
+ access_anonymous
42
+ get :new, plan_id: professional_plan.id
43
+ end
44
+ context 'redirects to the user sign up page' do
45
+ subject { response }
46
+ it { should redirect_to '/users/sign_in' }
47
+ it { should have_http_status(302) }
48
+ end
49
+ end
50
+ context "when the user is signed in" do
51
+ context 'when upgrading' do
52
+ context 'with a paid plan' do
53
+ include_context 'subscribers'
54
+ before :each do
55
+ sign_in free_subscriber
56
+ get :new, plan_id: professional_plan.id
57
+ end
58
+ context "responds successfully with an HTTP 200 status code" do
59
+ subject { response }
60
+ it { should be_success }
61
+ it { should have_http_status(200) }
62
+ end
63
+ context "renders the new template" do
64
+ subject { response }
65
+ it { should render_template("new") }
66
+ end
67
+ context "loads the requested plan into @plan" do
68
+ subject { assigns(:plan) }
69
+ it { should eq(professional_plan) }
70
+ end
71
+ end
72
+ context 'with the free plan' do
73
+ include_context 'subscribers'
74
+ before :each do
75
+ login_subscriber no_ads_subscriber
76
+ get :new, plan_id: free_plan.id
77
+ end
78
+ context "redirects to the subscriptions index page" do
79
+ subject { response }
80
+ it { should redirect_to subscriptions_path }
81
+ it { should have_http_status(302) }
82
+ end
83
+ context "sets a flash message" do
84
+ subject { flash[:notice] }
85
+ it { should match /You are now subscribed to the #{free_plan.name} Plan/ }
86
+ end
87
+ end
88
+ context 'when downgrading' do
89
+ include_context 'subscribers'
90
+ before :each do
91
+ sign_in professional_subscriber
92
+ get :new, plan_id: no_ads_plan.id
93
+ end
94
+ context "redirects to the subscriptions index page" do
95
+ subject { response }
96
+ it { should redirect_to subscriptions_path }
97
+ it { should have_http_status(302) }
98
+ end
99
+ context "sets a flash message" do
100
+ subject { flash[:notice] }
101
+ it { should match /You are now subscribed to the #{no_ads_plan.name} Plan/ }
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
107
+
108
+ describe "POST #create" do
109
+ context "when the user is anonymous" do
110
+ before :each do
111
+ access_anonymous
112
+ get :index
113
+ end
114
+ context 'redirects to the user sign up page' do
115
+ subject { response }
116
+ it { should redirect_to '/users/sign_in' }
117
+ it { should have_http_status(302) }
118
+ end
119
+ end
120
+ context "when the user is signed in" do
121
+ context "upgrading from the free plan" do
122
+ include_context 'subscribers'
123
+ before :each do
124
+ sign_in free_subscriber
125
+ token = working_stripe_token free_subscriber
126
+ post :create, plan_id: professional_plan.id, stripeToken: token
127
+ end
128
+ context "redirects to the subscriptions index page" do
129
+ subject { response }
130
+ it { should redirect_to subscriptions_path }
131
+ it { should have_http_status(302) }
132
+ end
133
+ context "sets a flash message" do
134
+ subject { flash[:notice] }
135
+ it { should match /You are now subscribed to the #{professional_plan.name} Plan/ }
136
+ end
137
+ end
138
+
139
+ context "upgrading from the no ads plan" do
140
+ include_context 'subscribers'
141
+ before :each do
142
+ sign_in no_ads_subscriber
143
+ post :create, plan_id: professional_plan.id
144
+ end
145
+ context "redirects to the subscriptions index page" do
146
+ subject { response }
147
+ it { should redirect_to subscriptions_path }
148
+ it { should have_http_status(302) }
149
+ end
150
+ context "sets a flash message" do
151
+ subject { flash[:notice] }
152
+ it { should match /You are now subscribed to the #{professional_plan.name} Plan/ }
153
+ end
154
+ end
155
+ end
156
+ end
157
+
158
+ describe "GET #index" do
159
+ context "when the user is anonymous" do
160
+ before :each do
161
+ access_anonymous
162
+ get :index
163
+ end
164
+ context 'redirects to the user sign up page' do
165
+ subject { response }
166
+ it { should redirect_to '/users/sign_in' }
167
+ it { should have_http_status(302) }
168
+ end
169
+ end
170
+ context "when the user is signed in" do
171
+ include_context 'subscribers'
172
+ before :each do
173
+ sign_in free_subscriber
174
+ get :index
175
+ end
176
+ context "responds successfully with an HTTP 200 status code" do
177
+ subject { response }
178
+ it { should be_success }
179
+ it { should have_http_status(200) }
180
+ end
181
+ context "renders the index template" do
182
+ subject { response }
183
+ it { should render_template("index") }
184
+ end
185
+ end
186
+ end
187
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require bootstrap-sprockets
16
+ //= require_tree .
@@ -0,0 +1,16 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ */
13
+
14
+ // "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
15
+ @import "bootstrap-sprockets";
16
+ @import "bootstrap";
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,3 @@
1
+ class Group < ActiveRecord::Base
2
+ belongs_to :user
3
+ end
@@ -0,0 +1,9 @@
1
+ class User < ActiveRecord::Base
2
+ subscriber
3
+ # Include default devise modules. Others available are:
4
+ # :confirmable, :lockable, :timeoutable and :omniauthable
5
+ devise :database_authenticatable, :registerable,
6
+ :recoverable, :rememberable, :trackable, :validatable
7
+
8
+ has_many :groups
9
+ end
@@ -0,0 +1,31 @@
1
+ %head
2
+ = render_title # For the title tag, including SEO content
3
+ = render_keywords # Defaults to what you put in the config file
4
+ = render_description # Can be hooked up within a mountable rails engine, too.
5
+ = responsive_meta_tag # If you're using the responsive features, you need this in your head
6
+
7
+ = stylesheet_link_tag 'application'
8
+
9
+ = render_head_css
10
+ = javascript_include_tag 'application'
11
+ = csrf_meta_tags
12
+
13
+ %body
14
+ .container
15
+ = render_h1 # For the h1 tag containing the title alone
16
+ = alert_flash_messages
17
+ = yield
18
+
19
+ %footer
20
+ - add_widget do
21
+ .clearfix
22
+ = nav_list :class => 'nav-pills nav-stacked' do
23
+ = nav_item :plans.l, paid_up.plans_path
24
+ - if signed_in?
25
+ = nav_item :my_subscription.l, paid_up.subscriptions_path
26
+ = nav_item :sign_out.l, main_app.destroy_user_session_path, method: :delete
27
+ - else
28
+ = nav_item :sign_in.l, main_app.new_user_session_path
29
+ = nav_item :sign_up.l, main_app.new_user_registration_path
30
+ = render_widgets 'md', 3
31
+ = render_footer_javascript
@@ -0,0 +1 @@
1
+ = Forgery('lorem_ipsum').paragraphs(5)
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "action_view/railtie"
8
+ require "sprockets/railtie"
9
+ # require "rails/test_unit/railtie"
10
+
11
+ Bundler.require(*Rails.groups)
12
+ require "paid_up"
13
+
14
+ module Dummy
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+
20
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
+ # config.time_zone = 'Central Time (US & Canada)'
23
+
24
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
+ # config.i18n.default_locale = :de
27
+
28
+ # Do not swallow errors in after_commit/after_rollback callbacks.
29
+ config.active_record.raise_in_transactional_callbacks = true
30
+ end
31
+ end
32
+