solidus_volume_pricing 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.hound.yml +40 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +8 -0
  6. data/.travis.yml +14 -0
  7. data/CONTRIBUTING.md +81 -0
  8. data/Gemfile +13 -0
  9. data/Guardfile +9 -0
  10. data/LICENSE.md +26 -0
  11. data/README.md +112 -0
  12. data/Rakefile +21 -0
  13. data/app/assets/javascripts/spree/backend/solidus_volume_pricing.js +16 -0
  14. data/app/controllers/spree/admin/variants_controller_decorator.rb +32 -0
  15. data/app/controllers/spree/admin/volume_price_models_controller.rb +27 -0
  16. data/app/controllers/spree/admin/volume_prices_controller.rb +11 -0
  17. data/app/helpers/spree/base_helper_decorator.rb +19 -0
  18. data/app/models/spree/line_item_decorator.rb +27 -0
  19. data/app/models/spree/user_decorator.rb +10 -0
  20. data/app/models/spree/variant_decorator.rb +104 -0
  21. data/app/models/spree/volume_price.rb +35 -0
  22. data/app/models/spree/volume_price_model.rb +8 -0
  23. data/app/overrides/spree/admin/shared/sub_menu/_configuration/add_volume_price_model_admin_menu_links.html.erb.deface +3 -0
  24. data/app/overrides/views_decorator.rb +13 -0
  25. data/app/views/spree/admin/shared/_vp_product_tab.html.erb +3 -0
  26. data/app/views/spree/admin/variants/_edit_fields.html.erb +33 -0
  27. data/app/views/spree/admin/variants/volume_prices.html.erb +39 -0
  28. data/app/views/spree/admin/volume_price_models/_form.html.erb +9 -0
  29. data/app/views/spree/admin/volume_price_models/_list.html.erb +23 -0
  30. data/app/views/spree/admin/volume_price_models/edit.html.erb +12 -0
  31. data/app/views/spree/admin/volume_price_models/index.html.erb +18 -0
  32. data/app/views/spree/admin/volume_price_models/new.html.erb +12 -0
  33. data/app/views/spree/admin/volume_prices/_edit_fields.html.erb +31 -0
  34. data/app/views/spree/admin/volume_prices/_volume_price_fields.html.erb +33 -0
  35. data/app/views/spree/products/_volume_pricing.html.erb +15 -0
  36. data/bin/rails +7 -0
  37. data/config/locales/de.yml +18 -0
  38. data/config/locales/en.yml +18 -0
  39. data/config/locales/pt.yml +18 -0
  40. data/config/locales/ru.yml +18 -0
  41. data/config/locales/sv.yml +18 -0
  42. data/config/locales/tr.yml +18 -0
  43. data/config/routes.rb +12 -0
  44. data/db/migrate/20081119145604_create_volume_prices.rb +16 -0
  45. data/db/migrate/20110203174010_change_display_name_for_volume_prices.rb +9 -0
  46. data/db/migrate/20111206173307_prefix_volume_pricing_table_names.rb +5 -0
  47. data/db/migrate/20121115043422_add_discount_type_column.rb +5 -0
  48. data/db/migrate/20150513200904_add_role_to_volume_price.rb +5 -0
  49. data/db/migrate/20150603143015_create_spree_volume_price_models.rb +18 -0
  50. data/lib/generators/solidus_volume_pricing/install/install_generator.rb +24 -0
  51. data/lib/solidus_volume_pricing.rb +6 -0
  52. data/lib/solidus_volume_pricing/engine.rb +42 -0
  53. data/lib/solidus_volume_pricing/version.rb +18 -0
  54. data/solidus_volume_pricing.gemspec +40 -0
  55. data/spec/controllers/spree/admin/variants_controller_spec.rb +27 -0
  56. data/spec/factories/volume_price_factory.rb +12 -0
  57. data/spec/helpers/base_helper_spec.rb +22 -0
  58. data/spec/models/spree/line_item_spec.rb +34 -0
  59. data/spec/models/spree/order_spec.rb +49 -0
  60. data/spec/models/spree/variant_spec.rb +306 -0
  61. data/spec/models/spree/volume_price_spec.rb +121 -0
  62. data/spec/spec_helper.rb +41 -0
  63. data/spec/support/capybara.rb +12 -0
  64. data/spec/support/database_cleaner.rb +24 -0
  65. data/spec/support/factory_girl.rb +7 -0
  66. data/spec/support/spree.rb +10 -0
  67. metadata +337 -0
@@ -0,0 +1,41 @@
1
+ require 'simplecov'
2
+ SimpleCov.start 'rails'
3
+
4
+ ENV['RAILS_ENV'] ||= 'test'
5
+
6
+ begin
7
+ require File.expand_path('../dummy/config/environment', __FILE__)
8
+ rescue LoadError
9
+ puts 'Could not load dummy application. Please ensure you have run `bundle exec rake test_app`'
10
+ exit
11
+ end
12
+
13
+ require 'rspec/rails'
14
+ require 'ffaker'
15
+ require 'shoulda-matchers'
16
+ require 'pry'
17
+
18
+ RSpec.configure do |config|
19
+ config.fail_fast = false
20
+ config.filter_run focus: true
21
+ config.run_all_when_everything_filtered = true
22
+
23
+ config.mock_with :rspec
24
+ config.use_transactional_fixtures = false
25
+ config.raise_errors_for_deprecations!
26
+ config.infer_spec_type_from_file_location!
27
+
28
+ config.expect_with :rspec do |expectations|
29
+ expectations.syntax = :expect
30
+ end
31
+ end
32
+
33
+ # From: https://github.com/thoughtbot/shoulda-matchers/issues/384
34
+ Shoulda::Matchers.configure do |config|
35
+ config.integrate do |with|
36
+ with.test_framework :rspec
37
+ with.library :rails
38
+ end
39
+ end
40
+
41
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |file| require file }
@@ -0,0 +1,12 @@
1
+ require 'capybara'
2
+ require 'capybara/rspec'
3
+ require 'capybara/rails'
4
+ require 'capybara/poltergeist'
5
+
6
+ RSpec.configure do
7
+ Capybara.javascript_driver = :poltergeist
8
+
9
+ Capybara.register_driver(:poltergeist) do |app|
10
+ Capybara::Poltergeist::Driver.new app, js_errors: true, timeout: 60
11
+ end
12
+ end
@@ -0,0 +1,24 @@
1
+ require 'database_cleaner'
2
+
3
+ RSpec.configure do |config|
4
+
5
+ config.before(:suite) do
6
+ DatabaseCleaner.clean_with :truncation
7
+ end
8
+
9
+ config.before do
10
+ DatabaseCleaner.strategy = :transaction
11
+ end
12
+
13
+ config.before(:each, :js) do
14
+ DatabaseCleaner.strategy = :truncation
15
+ end
16
+
17
+ config.before do
18
+ DatabaseCleaner.start
19
+ end
20
+
21
+ config.after do
22
+ DatabaseCleaner.clean
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ require 'factory_girl'
2
+
3
+ FactoryGirl.find_definitions
4
+
5
+ RSpec.configure do |config|
6
+ config.include FactoryGirl::Syntax::Methods
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'spree/testing_support/factories'
2
+ require 'spree/testing_support/controller_requests'
3
+ require 'spree/testing_support/authorization_helpers'
4
+ require 'spree/testing_support/url_helpers'
5
+ require 'spree/testing_support/capybara_ext'
6
+
7
+ RSpec.configure do |config|
8
+ config.include Spree::TestingSupport::ControllerRequests, type: :controller
9
+ config.include Spree::TestingSupport::UrlHelpers
10
+ end
metadata ADDED
@@ -0,0 +1,337 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: solidus_volume_pricing
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sean Schofield
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: solidus_core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.3'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.3'
33
+ - !ruby/object:Gem::Dependency
34
+ name: deface
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: sqlite3
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.3.10
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.3.10
61
+ - !ruby/object:Gem::Dependency
62
+ name: capybara
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '2.4'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.4'
75
+ - !ruby/object:Gem::Dependency
76
+ name: ffaker
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 1.32.1
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 1.32.1
89
+ - !ruby/object:Gem::Dependency
90
+ name: shoulda-matchers
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec-rails
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '3.2'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '3.2'
117
+ - !ruby/object:Gem::Dependency
118
+ name: simplecov
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.9'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '0.9'
131
+ - !ruby/object:Gem::Dependency
132
+ name: factory_girl
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '4.5'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '4.5'
145
+ - !ruby/object:Gem::Dependency
146
+ name: pry-rails
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0.3'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0.3'
159
+ - !ruby/object:Gem::Dependency
160
+ name: poltergeist
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: '1.6'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: '1.6'
173
+ - !ruby/object:Gem::Dependency
174
+ name: database_cleaner
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: '1.4'
180
+ type: :development
181
+ prerelease: false
182
+ version_requirements: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - "~>"
185
+ - !ruby/object:Gem::Version
186
+ version: '1.4'
187
+ - !ruby/object:Gem::Dependency
188
+ name: coffee-rails
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - "~>"
192
+ - !ruby/object:Gem::Version
193
+ version: '4.0'
194
+ type: :development
195
+ prerelease: false
196
+ version_requirements: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '4.0'
201
+ - !ruby/object:Gem::Dependency
202
+ name: sass-rails
203
+ requirement: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: '5.0'
208
+ type: :development
209
+ prerelease: false
210
+ version_requirements: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - "~>"
213
+ - !ruby/object:Gem::Version
214
+ version: '5.0'
215
+ - !ruby/object:Gem::Dependency
216
+ name: rubocop
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: 0.24.1
222
+ type: :development
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - ">="
227
+ - !ruby/object:Gem::Version
228
+ version: 0.24.1
229
+ description: Allow prices to be configured in quantity ranges for each variant
230
+ email: sean@railsdog.com
231
+ executables: []
232
+ extensions: []
233
+ extra_rdoc_files: []
234
+ files:
235
+ - ".gitignore"
236
+ - ".hound.yml"
237
+ - ".rspec"
238
+ - ".rubocop.yml"
239
+ - ".travis.yml"
240
+ - CONTRIBUTING.md
241
+ - Gemfile
242
+ - Guardfile
243
+ - LICENSE.md
244
+ - README.md
245
+ - Rakefile
246
+ - app/assets/javascripts/spree/backend/solidus_volume_pricing.js
247
+ - app/controllers/spree/admin/variants_controller_decorator.rb
248
+ - app/controllers/spree/admin/volume_price_models_controller.rb
249
+ - app/controllers/spree/admin/volume_prices_controller.rb
250
+ - app/helpers/spree/base_helper_decorator.rb
251
+ - app/models/spree/line_item_decorator.rb
252
+ - app/models/spree/user_decorator.rb
253
+ - app/models/spree/variant_decorator.rb
254
+ - app/models/spree/volume_price.rb
255
+ - app/models/spree/volume_price_model.rb
256
+ - app/overrides/spree/admin/shared/sub_menu/_configuration/add_volume_price_model_admin_menu_links.html.erb.deface
257
+ - app/overrides/views_decorator.rb
258
+ - app/views/spree/admin/shared/_vp_product_tab.html.erb
259
+ - app/views/spree/admin/variants/_edit_fields.html.erb
260
+ - app/views/spree/admin/variants/volume_prices.html.erb
261
+ - app/views/spree/admin/volume_price_models/_form.html.erb
262
+ - app/views/spree/admin/volume_price_models/_list.html.erb
263
+ - app/views/spree/admin/volume_price_models/edit.html.erb
264
+ - app/views/spree/admin/volume_price_models/index.html.erb
265
+ - app/views/spree/admin/volume_price_models/new.html.erb
266
+ - app/views/spree/admin/volume_prices/_edit_fields.html.erb
267
+ - app/views/spree/admin/volume_prices/_volume_price_fields.html.erb
268
+ - app/views/spree/products/_volume_pricing.html.erb
269
+ - bin/rails
270
+ - config/locales/de.yml
271
+ - config/locales/en.yml
272
+ - config/locales/pt.yml
273
+ - config/locales/ru.yml
274
+ - config/locales/sv.yml
275
+ - config/locales/tr.yml
276
+ - config/routes.rb
277
+ - db/migrate/20081119145604_create_volume_prices.rb
278
+ - db/migrate/20110203174010_change_display_name_for_volume_prices.rb
279
+ - db/migrate/20111206173307_prefix_volume_pricing_table_names.rb
280
+ - db/migrate/20121115043422_add_discount_type_column.rb
281
+ - db/migrate/20150513200904_add_role_to_volume_price.rb
282
+ - db/migrate/20150603143015_create_spree_volume_price_models.rb
283
+ - lib/generators/solidus_volume_pricing/install/install_generator.rb
284
+ - lib/solidus_volume_pricing.rb
285
+ - lib/solidus_volume_pricing/engine.rb
286
+ - lib/solidus_volume_pricing/version.rb
287
+ - solidus_volume_pricing.gemspec
288
+ - spec/controllers/spree/admin/variants_controller_spec.rb
289
+ - spec/factories/volume_price_factory.rb
290
+ - spec/helpers/base_helper_spec.rb
291
+ - spec/models/spree/line_item_spec.rb
292
+ - spec/models/spree/order_spec.rb
293
+ - spec/models/spree/variant_spec.rb
294
+ - spec/models/spree/volume_price_spec.rb
295
+ - spec/spec_helper.rb
296
+ - spec/support/capybara.rb
297
+ - spec/support/database_cleaner.rb
298
+ - spec/support/factory_girl.rb
299
+ - spec/support/spree.rb
300
+ homepage: https://github.com/solidusio-contrib/solidus_volume_pricing
301
+ licenses:
302
+ - BSD-3
303
+ metadata: {}
304
+ post_install_message:
305
+ rdoc_options: []
306
+ require_paths:
307
+ - lib
308
+ required_ruby_version: !ruby/object:Gem::Requirement
309
+ requirements:
310
+ - - ">="
311
+ - !ruby/object:Gem::Version
312
+ version: 2.2.3
313
+ required_rubygems_version: !ruby/object:Gem::Requirement
314
+ requirements:
315
+ - - ">="
316
+ - !ruby/object:Gem::Version
317
+ version: '0'
318
+ requirements:
319
+ - none
320
+ rubyforge_project:
321
+ rubygems_version: 2.5.2
322
+ signing_key:
323
+ specification_version: 4
324
+ summary: Allow prices to be configured in quantity ranges for each variant
325
+ test_files:
326
+ - spec/controllers/spree/admin/variants_controller_spec.rb
327
+ - spec/factories/volume_price_factory.rb
328
+ - spec/helpers/base_helper_spec.rb
329
+ - spec/models/spree/line_item_spec.rb
330
+ - spec/models/spree/order_spec.rb
331
+ - spec/models/spree/variant_spec.rb
332
+ - spec/models/spree/volume_price_spec.rb
333
+ - spec/spec_helper.rb
334
+ - spec/support/capybara.rb
335
+ - spec/support/database_cleaner.rb
336
+ - spec/support/factory_girl.rb
337
+ - spec/support/spree.rb