spree_reffiliate 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/ .travis.yml +3 -0
  3. data/.gitignore +14 -0
  4. data/.rspec +2 -0
  5. data/Gemfile +9 -0
  6. data/LICENSE +26 -0
  7. data/README.md +121 -0
  8. data/Rakefile +21 -0
  9. data/app/controllers/spree/admin/affiliates_controller.rb +23 -0
  10. data/app/controllers/spree/reffiliate_controller.rb +22 -0
  11. data/app/controllers/spree/user_controller_decorator.rb +6 -0
  12. data/app/models/spree/affiliate.rb +39 -0
  13. data/app/models/spree/promotion/rules/affiliated_promotion_rule.rb +37 -0
  14. data/app/models/spree/promotion/rules/referred_promotion_rule.rb +15 -0
  15. data/app/models/spree/referral.rb +40 -0
  16. data/app/models/spree/referred_record.rb +9 -0
  17. data/app/models/spree/user_decorator.rb +41 -0
  18. data/app/overrides/spree/admin/shared/_configuration_menu.rb +6 -0
  19. data/app/overrides/spree/admin/users/edit.rb +50 -0
  20. data/app/overrides/spree/admin/users/index.rb +18 -0
  21. data/app/overrides/spree/users/show.rb +12 -0
  22. data/app/views/spree/admin/affiliates/_form.html.erb +45 -0
  23. data/app/views/spree/admin/affiliates/edit.html.erb +76 -0
  24. data/app/views/spree/admin/affiliates/index.html.erb +55 -0
  25. data/app/views/spree/admin/affiliates/new.html.erb +23 -0
  26. data/app/views/spree/admin/promotions/rules/_affiliated_promotion_rule.erb +6 -0
  27. data/app/views/spree/admin/promotions/rules/_referred_promotion_rule.html.erb +0 -0
  28. data/bin/rails +7 -0
  29. data/config/initializers/spree.rb +6 -0
  30. data/config/locales/en.yml +10 -0
  31. data/config/routes.rb +8 -0
  32. data/db/migrate/20140907041850_create_spree_referrals.rb +8 -0
  33. data/db/migrate/20140907042024_create_spree_affiliates.rb +9 -0
  34. data/db/migrate/20140907042102_create_spree_referred_records.rb +9 -0
  35. data/db/migrate/20140907062121_add_index_to_spree_referrals.rb +5 -0
  36. data/db/migrate/20140907062422_add_index_to_spree_referred_record.rb +5 -0
  37. data/db/migrate/20140912003727_create_spree_promotion_rules_affiliates.rb +10 -0
  38. data/db/migrate/20140913042034_add_layout_to_spree_affiliate.rb +5 -0
  39. data/lib/generators/spree_reffiliate/install/install_generator.rb +21 -0
  40. data/lib/spree_reffiliate/engine.rb +20 -0
  41. data/lib/spree_reffiliate/factories.rb +12 -0
  42. data/lib/spree_reffiliate.rb +2 -0
  43. data/lib/tasks/spree_reffiliate.rake +10 -0
  44. data/spec/assets/spree/affiliates/corona.html.erb +1 -0
  45. data/spec/controllers/spree/reffiliate_controller_spec.rb +56 -0
  46. data/spec/controllers/spree/user_controller_spec.rb +20 -0
  47. data/spec/models/spree/affiliate_spec.rb +33 -0
  48. data/spec/models/spree/promotion/rules/affiliated_promotion_rule_spec.rb +46 -0
  49. data/spec/models/spree/promotion/rules/referred_promotion_rule_spec.rb +20 -0
  50. data/spec/models/spree/referral_spec.rb +41 -0
  51. data/spec/models/spree/referred_record_spec.rb +29 -0
  52. data/spec/models/spree/user_spec.rb +52 -0
  53. data/spec/spec_helper.rb +93 -0
  54. data/spree_reffiliate.gemspec +31 -0
  55. metadata +261 -0
@@ -0,0 +1,93 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
4
+ # Run Coverage report
5
+ require 'simplecov'
6
+ SimpleCov.start do
7
+ add_filter 'spec/dummy'
8
+ add_group 'Controllers', 'app/controllers'
9
+ add_group 'Helpers', 'app/helpers'
10
+ add_group 'Mailers', 'app/mailers'
11
+ add_group 'Models', 'app/models'
12
+ add_group 'Views', 'app/views'
13
+ add_group 'Libraries', 'lib'
14
+ end
15
+
16
+ # Configure Rails Environment
17
+ ENV['RAILS_ENV'] = 'test'
18
+
19
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
20
+
21
+ require 'rspec/rails'
22
+ require 'database_cleaner'
23
+ require 'ffaker'
24
+
25
+ # Requires supporting ruby files with custom matchers and macros, etc,
26
+ # in spec/support/ and its subdirectories.
27
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
28
+
29
+ # Requires factories and other useful helpers defined in spree_core.
30
+ require 'spree/testing_support/authorization_helpers'
31
+ require 'spree/testing_support/capybara_ext'
32
+ require 'spree/testing_support/controller_requests'
33
+ require 'spree/testing_support/factories'
34
+ require 'spree/testing_support/url_helpers'
35
+
36
+ # Requires factories defined in lib/spree_refiliate/factories.rb
37
+ require 'spree_reffiliate/factories'
38
+
39
+ RSpec.configure do |config|
40
+ # Customs
41
+ config.include Rails.application.routes.url_helpers
42
+ config.include Spree::TestingSupport::ControllerRequests, :type => :controller
43
+ config.include Devise::TestHelpers, :type => :controller
44
+ config.infer_spec_type_from_file_location!
45
+
46
+ config.include FactoryGirl::Syntax::Methods
47
+
48
+ # == URL Helpers
49
+ #
50
+ # Allows access to Spree's routes in specs:
51
+ #
52
+ # visit spree.admin_path
53
+ # current_path.should eql(spree.products_path)
54
+ config.include Spree::TestingSupport::UrlHelpers
55
+
56
+ # == Mock Framework
57
+ #
58
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
59
+ #
60
+ # config.mock_with :mocha
61
+ # config.mock_with :flexmock
62
+ # config.mock_with :rr
63
+ config.mock_with :rspec
64
+ config.color = true
65
+
66
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
67
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
68
+
69
+ # Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
70
+ # to cleanup after each test instead. Without transactional fixtures set to false the records created
71
+ # to setup a test will be unavailable to the browser, which runs under a separate server instance.
72
+ config.use_transactional_fixtures = false
73
+
74
+ # Ensure Suite is set to use transactions for speed.
75
+ config.before :suite do
76
+ DatabaseCleaner.strategy = :transaction
77
+ DatabaseCleaner.clean_with :truncation
78
+ end
79
+
80
+ # Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
81
+ config.before :each do |example|
82
+ DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
83
+ DatabaseCleaner.start
84
+ end
85
+
86
+ # After each spec clean the database.
87
+ config.after :each do
88
+ DatabaseCleaner.clean
89
+ end
90
+
91
+ config.fail_fast = ENV['FAIL_FAST'] || false
92
+ config.order = "random"
93
+ end
@@ -0,0 +1,31 @@
1
+ # encoding: UTF-8
2
+ Gem::Specification.new do |s|
3
+ s.platform = Gem::Platform::RUBY
4
+ s.name = 'spree_reffiliate'
5
+ s.version = '2.3.1'
6
+ s.author = 'Alejandro AR'
7
+ s.email = 'abarcadabra@gmail.com'
8
+ s.summary = 'Spree Affiliate and Referrals extension'
9
+ s.description = 'Configurable affiliates and referrals features for Spree'
10
+ s.homepage = 'https://github.com/kinduff/spree_reffiliate'
11
+ s.license = 'New-BSD'
12
+
13
+ s.required_ruby_version = '>= 1.9.3'
14
+
15
+ s.files = `git ls-files`.split($/)
16
+ s.test_files = s.files.grep(%r{^spec/})
17
+ s.require_path = 'lib'
18
+
19
+ s.add_dependency 'spree_core', '~> 2.3.1'
20
+
21
+ s.add_development_dependency 'capybara', '~> 2.1'
22
+ s.add_development_dependency 'coffee-rails'
23
+ s.add_development_dependency 'database_cleaner'
24
+ s.add_development_dependency 'factory_girl', '~> 4.4'
25
+ s.add_development_dependency 'ffaker'
26
+ s.add_development_dependency 'rspec-rails', '~> 2.13'
27
+ s.add_development_dependency 'sass-rails', '~> 4.0.2'
28
+ s.add_development_dependency 'selenium-webdriver'
29
+ s.add_development_dependency 'simplecov'
30
+ s.add_development_dependency 'sqlite3'
31
+ end
metadata ADDED
@@ -0,0 +1,261 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree_reffiliate
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.3.1
5
+ platform: ruby
6
+ authors:
7
+ - Alejandro AR
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: spree_core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.3.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.3.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: capybara
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coffee-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: database_cleaner
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: factory_girl
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '4.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '4.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ffaker
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.13'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.13'
111
+ - !ruby/object:Gem::Dependency
112
+ name: sass-rails
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 4.0.2
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 4.0.2
125
+ - !ruby/object:Gem::Dependency
126
+ name: selenium-webdriver
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: sqlite3
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: Configurable affiliates and referrals features for Spree
168
+ email: abarcadabra@gmail.com
169
+ executables: []
170
+ extensions: []
171
+ extra_rdoc_files: []
172
+ files:
173
+ - " .travis.yml"
174
+ - ".gitignore"
175
+ - ".rspec"
176
+ - Gemfile
177
+ - LICENSE
178
+ - README.md
179
+ - Rakefile
180
+ - app/controllers/spree/admin/affiliates_controller.rb
181
+ - app/controllers/spree/reffiliate_controller.rb
182
+ - app/controllers/spree/user_controller_decorator.rb
183
+ - app/models/spree/affiliate.rb
184
+ - app/models/spree/promotion/rules/affiliated_promotion_rule.rb
185
+ - app/models/spree/promotion/rules/referred_promotion_rule.rb
186
+ - app/models/spree/referral.rb
187
+ - app/models/spree/referred_record.rb
188
+ - app/models/spree/user_decorator.rb
189
+ - app/overrides/spree/admin/shared/_configuration_menu.rb
190
+ - app/overrides/spree/admin/users/edit.rb
191
+ - app/overrides/spree/admin/users/index.rb
192
+ - app/overrides/spree/users/show.rb
193
+ - app/views/spree/admin/affiliates/_form.html.erb
194
+ - app/views/spree/admin/affiliates/edit.html.erb
195
+ - app/views/spree/admin/affiliates/index.html.erb
196
+ - app/views/spree/admin/affiliates/new.html.erb
197
+ - app/views/spree/admin/promotions/rules/_affiliated_promotion_rule.erb
198
+ - app/views/spree/admin/promotions/rules/_referred_promotion_rule.html.erb
199
+ - bin/rails
200
+ - config/initializers/spree.rb
201
+ - config/locales/en.yml
202
+ - config/routes.rb
203
+ - db/migrate/20140907041850_create_spree_referrals.rb
204
+ - db/migrate/20140907042024_create_spree_affiliates.rb
205
+ - db/migrate/20140907042102_create_spree_referred_records.rb
206
+ - db/migrate/20140907062121_add_index_to_spree_referrals.rb
207
+ - db/migrate/20140907062422_add_index_to_spree_referred_record.rb
208
+ - db/migrate/20140912003727_create_spree_promotion_rules_affiliates.rb
209
+ - db/migrate/20140913042034_add_layout_to_spree_affiliate.rb
210
+ - lib/generators/spree_reffiliate/install/install_generator.rb
211
+ - lib/spree_reffiliate.rb
212
+ - lib/spree_reffiliate/engine.rb
213
+ - lib/spree_reffiliate/factories.rb
214
+ - lib/tasks/spree_reffiliate.rake
215
+ - spec/assets/spree/affiliates/corona.html.erb
216
+ - spec/controllers/spree/reffiliate_controller_spec.rb
217
+ - spec/controllers/spree/user_controller_spec.rb
218
+ - spec/models/spree/affiliate_spec.rb
219
+ - spec/models/spree/promotion/rules/affiliated_promotion_rule_spec.rb
220
+ - spec/models/spree/promotion/rules/referred_promotion_rule_spec.rb
221
+ - spec/models/spree/referral_spec.rb
222
+ - spec/models/spree/referred_record_spec.rb
223
+ - spec/models/spree/user_spec.rb
224
+ - spec/spec_helper.rb
225
+ - spree_reffiliate.gemspec
226
+ homepage: https://github.com/kinduff/spree_reffiliate
227
+ licenses:
228
+ - New-BSD
229
+ metadata: {}
230
+ post_install_message:
231
+ rdoc_options: []
232
+ require_paths:
233
+ - lib
234
+ required_ruby_version: !ruby/object:Gem::Requirement
235
+ requirements:
236
+ - - ">="
237
+ - !ruby/object:Gem::Version
238
+ version: 1.9.3
239
+ required_rubygems_version: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ requirements: []
245
+ rubyforge_project:
246
+ rubygems_version: 2.2.2
247
+ signing_key:
248
+ specification_version: 4
249
+ summary: Spree Affiliate and Referrals extension
250
+ test_files:
251
+ - spec/assets/spree/affiliates/corona.html.erb
252
+ - spec/controllers/spree/reffiliate_controller_spec.rb
253
+ - spec/controllers/spree/user_controller_spec.rb
254
+ - spec/models/spree/affiliate_spec.rb
255
+ - spec/models/spree/promotion/rules/affiliated_promotion_rule_spec.rb
256
+ - spec/models/spree/promotion/rules/referred_promotion_rule_spec.rb
257
+ - spec/models/spree/referral_spec.rb
258
+ - spec/models/spree/referred_record_spec.rb
259
+ - spec/models/spree/user_spec.rb
260
+ - spec/spec_helper.rb
261
+ has_rdoc: