catarse_credits 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +112 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.rdoc +3 -0
  7. data/Rakefile +40 -0
  8. data/app/assets/images/catarse_credits/.gitkeep +0 -0
  9. data/app/assets/javascripts/catarse_credits/application.js +15 -0
  10. data/app/assets/stylesheets/catarse_credits/application.css +13 -0
  11. data/app/controllers/catarse_credits/credits_controller.rb +36 -0
  12. data/app/helpers/catarse_credits/application_helper.rb +4 -0
  13. data/app/views/catarse_credits/credits/review.html.slim +16 -0
  14. data/app/views/layouts/catarse_credits/application.html.erb +14 -0
  15. data/catarse_credits.gemspec +25 -0
  16. data/config/initializers/register.rb +6 -0
  17. data/config/routes.rb +8 -0
  18. data/lib/catarse_credits.rb +5 -0
  19. data/lib/catarse_credits/engine.rb +5 -0
  20. data/lib/catarse_credits/payment_engine.rb +22 -0
  21. data/lib/catarse_credits/version.rb +3 -0
  22. data/lib/tasks/catarse_credits_tasks.rake +4 -0
  23. data/script/rails +8 -0
  24. data/spec/controllers/catarse_credits/credits_controller_spec.rb +68 -0
  25. data/spec/dummy/.gitignore +16 -0
  26. data/spec/dummy/Gemfile +40 -0
  27. data/spec/dummy/README.rdoc +28 -0
  28. data/spec/dummy/Rakefile +6 -0
  29. data/spec/dummy/app/assets/images/.keep +0 -0
  30. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  31. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  32. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  33. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  34. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  35. data/spec/dummy/app/mailers/.keep +0 -0
  36. data/spec/dummy/app/models/.keep +0 -0
  37. data/spec/dummy/app/models/concerns/.keep +0 -0
  38. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  39. data/spec/dummy/bin/bundle +3 -0
  40. data/spec/dummy/bin/rails +4 -0
  41. data/spec/dummy/bin/rake +4 -0
  42. data/spec/dummy/config.ru +4 -0
  43. data/spec/dummy/config/application.rb +23 -0
  44. data/spec/dummy/config/boot.rb +4 -0
  45. data/spec/dummy/config/database.yml +54 -0
  46. data/spec/dummy/config/environment.rb +5 -0
  47. data/spec/dummy/config/environments/development.rb +37 -0
  48. data/spec/dummy/config/environments/production.rb +82 -0
  49. data/spec/dummy/config/environments/test.rb +39 -0
  50. data/spec/dummy/config/initializers/assets.rb +8 -0
  51. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  52. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  53. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  54. data/spec/dummy/config/initializers/inflections.rb +16 -0
  55. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  56. data/spec/dummy/config/initializers/session_store.rb +3 -0
  57. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  58. data/spec/dummy/config/locales/en.yml +23 -0
  59. data/spec/dummy/config/routes.rb +57 -0
  60. data/spec/dummy/config/secrets.yml +22 -0
  61. data/spec/dummy/db/seeds.rb +7 -0
  62. data/spec/dummy/lib/assets/.keep +0 -0
  63. data/spec/dummy/lib/tasks/.keep +0 -0
  64. data/spec/dummy/log/.keep +0 -0
  65. data/spec/dummy/public/404.html +67 -0
  66. data/spec/dummy/public/422.html +67 -0
  67. data/spec/dummy/public/500.html +66 -0
  68. data/spec/dummy/public/favicon.ico +0 -0
  69. data/spec/dummy/public/robots.txt +5 -0
  70. data/spec/dummy/test/controllers/.keep +0 -0
  71. data/spec/dummy/test/fixtures/.keep +0 -0
  72. data/spec/dummy/test/helpers/.keep +0 -0
  73. data/spec/dummy/test/integration/.keep +0 -0
  74. data/spec/dummy/test/mailers/.keep +0 -0
  75. data/spec/dummy/test/models/.keep +0 -0
  76. data/spec/dummy/test/test_helper.rb +10 -0
  77. data/spec/dummy/vendor/assets/javascripts/.keep +0 -0
  78. data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
  79. data/spec/spec_helper.rb +34 -0
  80. data/spec/support/category.rb +2 -0
  81. data/spec/support/contribution.rb +15 -0
  82. data/spec/support/factories.rb +56 -0
  83. data/spec/support/payment_engines.rb +2 -0
  84. data/spec/support/project.rb +5 -0
  85. data/spec/support/user.rb +9 -0
  86. data/spec/support/user_total.rb +3 -0
  87. metadata +249 -0
@@ -0,0 +1,34 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+
4
+ require File.expand_path("../dummy/config/environment", __FILE__)
5
+
6
+ require 'rspec/rails'
7
+ require 'factory_girl'
8
+ # Requires supporting ruby files with custom matchers and macros, etc,
9
+ # in spec/support/ and its subdirectories.
10
+ Dir[ File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f}
11
+
12
+ RSpec.configure do |config|
13
+ config.include FactoryGirl::Syntax::Methods
14
+ config.use_transactional_examples = true
15
+
16
+ # If true, the base class of anonymous controllers will be inferred
17
+ # automatically. This will be the default behavior in future versions of
18
+ # rspec-rails.
19
+ config.infer_base_class_for_anonymous_controllers = false
20
+
21
+ # Run specs in random order to surface order dependencies. If you find an
22
+ # order dependency and want to debug it, you can fix the order by providing
23
+ # the seed, which is printed after each run.
24
+ # --seed 1234
25
+ config.order = "random"
26
+
27
+ config.expect_with :rspec do |c|
28
+ c.syntax = :expect
29
+ end
30
+
31
+ config.before(:each) do
32
+ PaymentEngines.stub(:configuration).and_return({})
33
+ end
34
+ end
@@ -0,0 +1,2 @@
1
+ class Category < ActiveRecord::Base
2
+ end
@@ -0,0 +1,15 @@
1
+ class Contribution < ActiveRecord::Base
2
+ belongs_to :user
3
+ belongs_to :project
4
+
5
+ def confirmed?
6
+ false
7
+ end
8
+
9
+ def update_current_billing_info
10
+ end
11
+
12
+ def confirm!
13
+ true
14
+ end
15
+ end
@@ -0,0 +1,56 @@
1
+ FactoryGirl.define do
2
+ sequence :name do |n|
3
+ "Foo bar #{n}"
4
+ end
5
+
6
+ sequence :email do |n|
7
+ "person#{n}@example.com"
8
+ end
9
+
10
+ sequence :uid do |n|
11
+ "#{n}"
12
+ end
13
+
14
+ sequence :permalink do |n|
15
+ "foo_page_#{n}"
16
+ end
17
+
18
+ factory :user do |f|
19
+ f.name "Foo bar"
20
+ f.email { generate(:email) }
21
+ f.bio "This is Foo bar's biography."
22
+ end
23
+
24
+ factory :category do |f|
25
+ f.name_pt { generate(:name) }
26
+ end
27
+
28
+ factory :project do |f|
29
+ f.name "Foo bar"
30
+ f.permalink { generate(:permalink) }
31
+ f.association :user, factory: :user
32
+ f.association :category, factory: :category
33
+ f.about "Foo bar"
34
+ f.headline "Foo bar"
35
+ f.goal 10000
36
+ f.online_date Time.now
37
+ f.online_days 5
38
+ f.how_know 'Lorem ipsum'
39
+ f.more_links 'Ipsum dolor'
40
+ f.first_contributions 'Foo bar'
41
+ f.video_url 'http://vimeo.com/17298435'
42
+ f.state 'online'
43
+ end
44
+
45
+ factory :contribution do |f|
46
+ f.association :project, factory: :project
47
+ f.association :user, factory: :user
48
+ f.confirmed_at Time.now
49
+ f.value 10.00
50
+ f.state 'confirmed'
51
+ f.credits false
52
+ f.payment_id '1.2.3'
53
+ end
54
+ end
55
+
56
+
@@ -0,0 +1,2 @@
1
+ class PaymentEngines
2
+ end
@@ -0,0 +1,5 @@
1
+ class Project < ActiveRecord::Base
2
+ belongs_to :user
3
+ belongs_to :category
4
+ has_many :contributions
5
+ end
@@ -0,0 +1,9 @@
1
+ class User < ActiveRecord::Base
2
+ has_many :projects
3
+ has_many :contributions
4
+ has_one :user_total
5
+
6
+ def credits
7
+ user_total.present? ? user_total.credits : 0
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ class UserTotal < ActiveRecord::Base
2
+ self.primary_key = :id
3
+ end
metadata ADDED
@@ -0,0 +1,249 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: catarse_credits
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Antônio Roberto Silva
8
+ - Diogo Biazus
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-07-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '4.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '4.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rspec-rails
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 2.14.0
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 2.14.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: factory_girl_rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: pg
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ description: Credits integration for catarse
71
+ email:
72
+ - forevertonny@gmail.com
73
+ - diogob@gmail.com
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - MIT-LICENSE
82
+ - README.rdoc
83
+ - Rakefile
84
+ - app/assets/images/catarse_credits/.gitkeep
85
+ - app/assets/javascripts/catarse_credits/application.js
86
+ - app/assets/stylesheets/catarse_credits/application.css
87
+ - app/controllers/catarse_credits/credits_controller.rb
88
+ - app/helpers/catarse_credits/application_helper.rb
89
+ - app/views/catarse_credits/credits/review.html.slim
90
+ - app/views/layouts/catarse_credits/application.html.erb
91
+ - catarse_credits.gemspec
92
+ - config/initializers/register.rb
93
+ - config/routes.rb
94
+ - lib/catarse_credits.rb
95
+ - lib/catarse_credits/engine.rb
96
+ - lib/catarse_credits/payment_engine.rb
97
+ - lib/catarse_credits/version.rb
98
+ - lib/tasks/catarse_credits_tasks.rake
99
+ - script/rails
100
+ - spec/controllers/catarse_credits/credits_controller_spec.rb
101
+ - spec/dummy/.gitignore
102
+ - spec/dummy/Gemfile
103
+ - spec/dummy/README.rdoc
104
+ - spec/dummy/Rakefile
105
+ - spec/dummy/app/assets/images/.keep
106
+ - spec/dummy/app/assets/javascripts/application.js
107
+ - spec/dummy/app/assets/stylesheets/application.css
108
+ - spec/dummy/app/controllers/application_controller.rb
109
+ - spec/dummy/app/controllers/concerns/.keep
110
+ - spec/dummy/app/helpers/application_helper.rb
111
+ - spec/dummy/app/mailers/.keep
112
+ - spec/dummy/app/models/.keep
113
+ - spec/dummy/app/models/concerns/.keep
114
+ - spec/dummy/app/views/layouts/application.html.erb
115
+ - spec/dummy/bin/bundle
116
+ - spec/dummy/bin/rails
117
+ - spec/dummy/bin/rake
118
+ - spec/dummy/config.ru
119
+ - spec/dummy/config/application.rb
120
+ - spec/dummy/config/boot.rb
121
+ - spec/dummy/config/database.yml
122
+ - spec/dummy/config/environment.rb
123
+ - spec/dummy/config/environments/development.rb
124
+ - spec/dummy/config/environments/production.rb
125
+ - spec/dummy/config/environments/test.rb
126
+ - spec/dummy/config/initializers/assets.rb
127
+ - spec/dummy/config/initializers/backtrace_silencers.rb
128
+ - spec/dummy/config/initializers/cookies_serializer.rb
129
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
130
+ - spec/dummy/config/initializers/inflections.rb
131
+ - spec/dummy/config/initializers/mime_types.rb
132
+ - spec/dummy/config/initializers/session_store.rb
133
+ - spec/dummy/config/initializers/wrap_parameters.rb
134
+ - spec/dummy/config/locales/en.yml
135
+ - spec/dummy/config/routes.rb
136
+ - spec/dummy/config/secrets.yml
137
+ - spec/dummy/db/seeds.rb
138
+ - spec/dummy/lib/assets/.keep
139
+ - spec/dummy/lib/tasks/.keep
140
+ - spec/dummy/log/.keep
141
+ - spec/dummy/public/404.html
142
+ - spec/dummy/public/422.html
143
+ - spec/dummy/public/500.html
144
+ - spec/dummy/public/favicon.ico
145
+ - spec/dummy/public/robots.txt
146
+ - spec/dummy/test/controllers/.keep
147
+ - spec/dummy/test/fixtures/.keep
148
+ - spec/dummy/test/helpers/.keep
149
+ - spec/dummy/test/integration/.keep
150
+ - spec/dummy/test/mailers/.keep
151
+ - spec/dummy/test/models/.keep
152
+ - spec/dummy/test/test_helper.rb
153
+ - spec/dummy/vendor/assets/javascripts/.keep
154
+ - spec/dummy/vendor/assets/stylesheets/.keep
155
+ - spec/spec_helper.rb
156
+ - spec/support/category.rb
157
+ - spec/support/contribution.rb
158
+ - spec/support/factories.rb
159
+ - spec/support/payment_engines.rb
160
+ - spec/support/project.rb
161
+ - spec/support/user.rb
162
+ - spec/support/user_total.rb
163
+ homepage: http://github.com/catarse/catarse_credits
164
+ licenses: []
165
+ metadata: {}
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.2.0
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: Credits System for catarse
186
+ test_files:
187
+ - spec/controllers/catarse_credits/credits_controller_spec.rb
188
+ - spec/dummy/.gitignore
189
+ - spec/dummy/Gemfile
190
+ - spec/dummy/README.rdoc
191
+ - spec/dummy/Rakefile
192
+ - spec/dummy/app/assets/images/.keep
193
+ - spec/dummy/app/assets/javascripts/application.js
194
+ - spec/dummy/app/assets/stylesheets/application.css
195
+ - spec/dummy/app/controllers/application_controller.rb
196
+ - spec/dummy/app/controllers/concerns/.keep
197
+ - spec/dummy/app/helpers/application_helper.rb
198
+ - spec/dummy/app/mailers/.keep
199
+ - spec/dummy/app/models/.keep
200
+ - spec/dummy/app/models/concerns/.keep
201
+ - spec/dummy/app/views/layouts/application.html.erb
202
+ - spec/dummy/bin/bundle
203
+ - spec/dummy/bin/rails
204
+ - spec/dummy/bin/rake
205
+ - spec/dummy/config.ru
206
+ - spec/dummy/config/application.rb
207
+ - spec/dummy/config/boot.rb
208
+ - spec/dummy/config/database.yml
209
+ - spec/dummy/config/environment.rb
210
+ - spec/dummy/config/environments/development.rb
211
+ - spec/dummy/config/environments/production.rb
212
+ - spec/dummy/config/environments/test.rb
213
+ - spec/dummy/config/initializers/assets.rb
214
+ - spec/dummy/config/initializers/backtrace_silencers.rb
215
+ - spec/dummy/config/initializers/cookies_serializer.rb
216
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
217
+ - spec/dummy/config/initializers/inflections.rb
218
+ - spec/dummy/config/initializers/mime_types.rb
219
+ - spec/dummy/config/initializers/session_store.rb
220
+ - spec/dummy/config/initializers/wrap_parameters.rb
221
+ - spec/dummy/config/locales/en.yml
222
+ - spec/dummy/config/routes.rb
223
+ - spec/dummy/config/secrets.yml
224
+ - spec/dummy/db/seeds.rb
225
+ - spec/dummy/lib/assets/.keep
226
+ - spec/dummy/lib/tasks/.keep
227
+ - spec/dummy/log/.keep
228
+ - spec/dummy/public/404.html
229
+ - spec/dummy/public/422.html
230
+ - spec/dummy/public/500.html
231
+ - spec/dummy/public/favicon.ico
232
+ - spec/dummy/public/robots.txt
233
+ - spec/dummy/test/controllers/.keep
234
+ - spec/dummy/test/fixtures/.keep
235
+ - spec/dummy/test/helpers/.keep
236
+ - spec/dummy/test/integration/.keep
237
+ - spec/dummy/test/mailers/.keep
238
+ - spec/dummy/test/models/.keep
239
+ - spec/dummy/test/test_helper.rb
240
+ - spec/dummy/vendor/assets/javascripts/.keep
241
+ - spec/dummy/vendor/assets/stylesheets/.keep
242
+ - spec/spec_helper.rb
243
+ - spec/support/category.rb
244
+ - spec/support/contribution.rb
245
+ - spec/support/factories.rb
246
+ - spec/support/payment_engines.rb
247
+ - spec/support/project.rb
248
+ - spec/support/user.rb
249
+ - spec/support/user_total.rb