catarse_credits 0.0.4 → 0.0.6

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_credits (0.0.1)
4
+ catarse_credits (0.0.6)
5
5
  rails (>= 4.0)
6
6
 
7
7
  GEM
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # CatarseCredits [![Code Climate](https://codeclimate.com/github/catarse/catarse_credits.png)](https://codeclimate.com/github/catarse/catarse_credits)
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
23
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
24
  load 'rails/tasks/engine.rake'
25
25
 
26
26
 
@@ -1,13 +1,14 @@
1
1
  class CatarseCredits::CreditsController < ApplicationController
2
2
  layout :false
3
3
  before_action :contribution
4
+ skip_before_filter :force_http
4
5
 
5
6
  def review
6
7
  end
7
8
 
8
9
  def pay
9
- if current_user && current_user == contribution.user
10
- if current_user.credits < contribution.value
10
+ if is_contribution_user?
11
+ if has_credits_to_do_contribution?
11
12
  return failed_contribution
12
13
  end
13
14
 
@@ -18,13 +19,21 @@ class CatarseCredits::CreditsController < ApplicationController
18
19
  end
19
20
 
20
21
  flash[:success] = t('projects.contributions.checkout.success')
21
- return redirect_to main_app.project_contribution_path(project_id: contribution.project.id, id: contribution.id)
22
+ redirect_to main_app.project_contribution_path(project_id: contribution.project.id, id: contribution.id)
22
23
  else
23
24
  failed_contribution
24
25
  end
25
26
  end
26
27
 
27
28
  protected
29
+ def is_contribution_user?
30
+ current_user && current_user == contribution.user
31
+ end
32
+
33
+ def has_credits_to_do_contribution?
34
+ current_user.credits < contribution.value
35
+ end
36
+
28
37
  def failed_contribution
29
38
  flash[:failure] = t('projects.contributions.checkout.no_credits')
30
39
  redirect_to main_app.new_project_contribution_path(contribution.project)
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  $:.push File.expand_path("../lib", __FILE__)
2
3
 
3
4
  # Maintain your gem's version:
@@ -1,3 +1,3 @@
1
1
  module CatarseCredits
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catarse_credits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Antônio Roberto Silva
@@ -9,62 +10,70 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-07-08 00:00:00.000000000 Z
13
+ date: 2014-08-04 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rails
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - ">="
20
+ - - ! '>='
19
21
  - !ruby/object:Gem::Version
20
22
  version: '4.0'
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - ">="
28
+ - - ! '>='
26
29
  - !ruby/object:Gem::Version
27
30
  version: '4.0'
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: rspec-rails
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
- - - "~>"
36
+ - - ~>
33
37
  - !ruby/object:Gem::Version
34
38
  version: 2.14.0
35
39
  type: :development
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
- - - "~>"
44
+ - - ~>
40
45
  - !ruby/object:Gem::Version
41
46
  version: 2.14.0
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: factory_girl_rails
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
- - - ">="
52
+ - - ! '>='
47
53
  - !ruby/object:Gem::Version
48
54
  version: '0'
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
- - - ">="
60
+ - - ! '>='
54
61
  - !ruby/object:Gem::Version
55
62
  version: '0'
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: pg
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
- - - ">="
68
+ - - ! '>='
61
69
  - !ruby/object:Gem::Version
62
70
  version: '0'
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
- - - ">="
76
+ - - ! '>='
68
77
  - !ruby/object:Gem::Version
69
78
  version: '0'
70
79
  description: Credits integration for catarse
@@ -75,11 +84,11 @@ executables: []
75
84
  extensions: []
76
85
  extra_rdoc_files: []
77
86
  files:
78
- - ".gitignore"
87
+ - .gitignore
79
88
  - Gemfile
80
89
  - Gemfile.lock
81
90
  - MIT-LICENSE
82
- - README.rdoc
91
+ - README.md
83
92
  - Rakefile
84
93
  - app/assets/images/catarse_credits/.gitkeep
85
94
  - app/assets/javascripts/catarse_credits/application.js
@@ -162,26 +171,27 @@ files:
162
171
  - spec/support/user_total.rb
163
172
  homepage: http://github.com/catarse/catarse_credits
164
173
  licenses: []
165
- metadata: {}
166
174
  post_install_message:
167
175
  rdoc_options: []
168
176
  require_paths:
169
177
  - lib
170
178
  required_ruby_version: !ruby/object:Gem::Requirement
179
+ none: false
171
180
  requirements:
172
- - - ">="
181
+ - - ! '>='
173
182
  - !ruby/object:Gem::Version
174
183
  version: '0'
175
184
  required_rubygems_version: !ruby/object:Gem::Requirement
185
+ none: false
176
186
  requirements:
177
- - - ">="
187
+ - - ! '>='
178
188
  - !ruby/object:Gem::Version
179
189
  version: '0'
180
190
  requirements: []
181
191
  rubyforge_project:
182
- rubygems_version: 2.2.2
192
+ rubygems_version: 1.8.21
183
193
  signing_key:
184
- specification_version: 4
194
+ specification_version: 3
185
195
  summary: Credits System for catarse
186
196
  test_files:
187
197
  - spec/controllers/catarse_credits/credits_controller_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 5281e939087960ddcf2fd8c8a6402acc05251ff7
4
- data.tar.gz: 195ea662f4b98b5cbc5f7ca019da33e8926dfdb2
5
- SHA512:
6
- metadata.gz: b784d7f57589c78d5eb49aa5963bc95d301dbf0340ca9597567d51e4fcd35773068c171d4ffb1ca30897298f1d568c21fe7fcef87cc144ae092394c15b222c5f
7
- data.tar.gz: 1edc10e4b063b92a40c28f9595e323f92d9d5c22f498a95ef9982e70107423ccdee8303f99d84d95b530eafb151d00d3abf5f7536f6ffc2bb23002015d5a2469
data/README.rdoc DELETED
@@ -1,3 +0,0 @@
1
- = CatarseCredits
2
-
3
- This project rocks and uses MIT-LICENSE.