solidus_volume_pricing 0.2.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +35 -0
  3. data/.gem_release.yml +5 -0
  4. data/.github/dependabot.yml +7 -0
  5. data/.github/stale.yml +17 -0
  6. data/.gitignore +14 -9
  7. data/.rspec +2 -2
  8. data/.rubocop.yml +3 -7
  9. data/.rubocop_todo.yml +126 -0
  10. data/CHANGELOG.md +86 -0
  11. data/Gemfile +25 -2
  12. data/Guardfile +3 -1
  13. data/{LICENSE.md → LICENSE} +2 -2
  14. data/README.md +55 -50
  15. data/Rakefile +4 -19
  16. data/app/assets/javascripts/spree/backend/solidus_volume_pricing.js +1 -15
  17. data/app/controllers/spree/admin/volume_price_models_controller.rb +2 -1
  18. data/app/controllers/spree/admin/volume_prices_controller.rb +3 -1
  19. data/app/decorators/controllers/solidus_volume_pricing/spree/admin/variants_controller_decorator.rb +42 -0
  20. data/app/decorators/helpers/solidus_volume_pricing/spree/base_helper_decorator.rb +31 -0
  21. data/app/decorators/models/solidus_volume_pricing/spree/line_item_decorator.rb +18 -0
  22. data/app/decorators/models/solidus_volume_pricing/spree/variant_decorator.rb +21 -0
  23. data/app/models/solidus_volume_pricing/price_display.rb +47 -0
  24. data/app/models/solidus_volume_pricing/pricer.rb +95 -0
  25. data/app/models/solidus_volume_pricing/pricing_options.rb +20 -0
  26. data/app/models/spree/volume_price.rb +43 -26
  27. data/app/models/spree/volume_price_model.rb +6 -4
  28. data/app/overrides/spree/admin/shared/_settings_sub_menu/add_volume_price_model_admin_menu_links.html.erb.deface +5 -0
  29. data/app/overrides/views_decorator.rb +2 -0
  30. data/app/views/spree/admin/shared/_vp_product_tab.html.erb +2 -2
  31. data/app/views/spree/admin/variants/_edit_fields.html.erb +5 -32
  32. data/app/views/spree/admin/variants/volume_prices.html.erb +9 -36
  33. data/app/views/spree/admin/volume_price_models/_form.html.erb +6 -2
  34. data/app/views/spree/admin/volume_price_models/_list.html.erb +8 -4
  35. data/app/views/spree/admin/volume_price_models/_select.html.erb +17 -0
  36. data/app/views/spree/admin/volume_price_models/edit.html.erb +7 -6
  37. data/app/views/spree/admin/volume_price_models/index.html.erb +7 -5
  38. data/app/views/spree/admin/volume_price_models/new.html.erb +5 -5
  39. data/app/views/spree/admin/volume_prices/_table.html.erb +26 -0
  40. data/app/views/spree/admin/volume_prices/_volume_price_fields.html.erb +10 -8
  41. data/app/views/spree/products/_volume_pricing.html.erb +8 -8
  42. data/bin/console +17 -0
  43. data/bin/rails +12 -4
  44. data/bin/setup +8 -0
  45. data/config/locales/de.yml +17 -3
  46. data/config/locales/en.yml +21 -2
  47. data/config/locales/pt.yml +6 -2
  48. data/config/locales/ru.yml +6 -2
  49. data/config/locales/sv.yml +6 -2
  50. data/config/locales/tr.yml +6 -2
  51. data/config/routes.rb +3 -1
  52. data/db/migrate/20081119145604_create_volume_prices.rb +3 -1
  53. data/db/migrate/20110203174010_change_display_name_for_volume_prices.rb +3 -1
  54. data/db/migrate/20111206173307_prefix_volume_pricing_table_names.rb +3 -1
  55. data/db/migrate/20121115043422_add_discount_type_column.rb +3 -1
  56. data/db/migrate/20150513200904_add_role_to_volume_price.rb +3 -1
  57. data/db/migrate/20150603143015_create_spree_volume_price_models.rb +3 -1
  58. data/lib/generators/solidus_volume_pricing/install/install_generator.rb +5 -5
  59. data/lib/solidus_volume_pricing/engine.rb +16 -24
  60. data/lib/solidus_volume_pricing/range_from_string.rb +36 -0
  61. data/lib/solidus_volume_pricing/testing_support/factories.rb +14 -0
  62. data/lib/solidus_volume_pricing/version.rb +3 -16
  63. data/lib/solidus_volume_pricing.rb +6 -1
  64. data/solidus_volume_pricing.gemspec +26 -23
  65. data/spec/controllers/spree/admin/variants_controller_spec.rb +18 -15
  66. data/spec/features/manage_volume_price_models_feature_spec.rb +5 -7
  67. data/spec/features/manage_volume_prices_feature_spec.rb +9 -8
  68. data/spec/helpers/base_helper_spec.rb +3 -1
  69. data/spec/lib/solidus_volume_pricing/range_from_string_spec.rb +61 -0
  70. data/spec/models/solidus_volume_pricing/pricer_spec.rb +669 -0
  71. data/spec/models/solidus_volume_pricing/pricing_options_spec.rb +57 -0
  72. data/spec/models/spree/line_item_spec.rb +23 -21
  73. data/spec/models/spree/order_spec.rb +4 -2
  74. data/spec/models/spree/variant_spec.rb +3 -303
  75. data/spec/models/spree/volume_price_spec.rb +145 -50
  76. data/spec/spec_helper.rb +15 -35
  77. data/spec/support/shoulda.rb +11 -0
  78. metadata +83 -161
  79. data/.hound.yml +0 -40
  80. data/.travis.yml +0 -12
  81. data/CONTRIBUTING.md +0 -81
  82. data/app/controllers/spree/admin/variants_controller_decorator.rb +0 -32
  83. data/app/helpers/spree/base_helper_decorator.rb +0 -19
  84. data/app/models/spree/line_item_decorator.rb +0 -13
  85. data/app/models/spree/user_decorator.rb +0 -10
  86. data/app/models/spree/variant_decorator.rb +0 -104
  87. data/app/overrides/spree/admin/shared/sub_menu/_configuration/add_volume_price_model_admin_menu_links.html.erb.deface +0 -3
  88. data/app/views/spree/admin/volume_prices/_edit_fields.html.erb +0 -31
  89. data/spec/factories/volume_price_factory.rb +0 -12
  90. data/spec/support/capybara.rb +0 -12
  91. data/spec/support/database_cleaner.rb +0 -21
  92. data/spec/support/factory_girl.rb +0 -7
  93. data/spec/support/spree.rb +0 -10
data/spec/spec_helper.rb CHANGED
@@ -1,44 +1,24 @@
1
- require 'simplecov'
2
- SimpleCov.start 'rails' do
3
- add_filter "/lib/generators"
4
- add_filter "/lib/solidus_volume_pricing"
5
- end
1
+ # frozen_string_literal: true
6
2
 
3
+ # Configure Rails Environment
7
4
  ENV['RAILS_ENV'] ||= 'test'
8
5
 
9
- begin
10
- require File.expand_path('../dummy/config/environment', __FILE__)
11
- rescue LoadError
12
- puts 'Could not load dummy application. Please ensure you have run `bundle exec rake test_app`'
13
- exit
14
- end
6
+ # Run Coverage report
7
+ require 'solidus_dev_support/rspec/coverage'
15
8
 
16
- require 'rspec/rails'
17
- require 'ffaker'
18
- require 'shoulda-matchers'
19
- require 'pry'
9
+ require File.expand_path('dummy/config/environment.rb', __dir__)
20
10
 
21
- RSpec.configure do |config|
22
- config.fail_fast = false
23
- config.filter_run focus: true
24
- config.run_all_when_everything_filtered = true
11
+ # Requires factories and other useful helpers defined in spree_core.
12
+ require 'solidus_dev_support/rspec/feature_helper'
25
13
 
26
- config.mock_with :rspec
27
- config.use_transactional_fixtures = false
28
- config.raise_errors_for_deprecations!
29
- config.infer_spec_type_from_file_location!
14
+ # Requires supporting ruby files with custom matchers and macros, etc,
15
+ # in spec/support/ and its subdirectories.
16
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
30
17
 
31
- config.expect_with :rspec do |expectations|
32
- expectations.syntax = :expect
33
- end
34
- end
18
+ # Requires factories defined in lib/solidus_volume_pricing/testing_support/factories.rb
19
+ SolidusDevSupport::TestingSupport::Factories.load_for(SolidusVolumePricing::Engine)
35
20
 
36
- # From: https://github.com/thoughtbot/shoulda-matchers/issues/384
37
- Shoulda::Matchers.configure do |config|
38
- config.integrate do |with|
39
- with.test_framework :rspec
40
- with.library :rails
41
- end
21
+ RSpec.configure do |config|
22
+ config.infer_spec_type_from_file_location!
23
+ config.use_transactional_fixtures = false
42
24
  end
43
-
44
- Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |file| require file }
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'shoulda-matchers'
4
+
5
+ # From: https://github.com/thoughtbot/shoulda-matchers/issues/384
6
+ Shoulda::Matchers.configure do |config|
7
+ config.integrate do |with|
8
+ with.test_framework :rspec
9
+ with.library :rails
10
+ end
11
+ end
metadata CHANGED
@@ -1,93 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_volume_pricing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
- autorequire:
9
- bindir: bin
8
+ autorequire:
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-20 00:00:00.000000000 Z
11
+ date: 2023-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: solidus_core
14
+ name: solidus_backend
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.3'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
17
+ - - ">="
25
18
  - !ruby/object:Gem::Version
26
- version: '1.3'
27
- - !ruby/object:Gem::Dependency
28
- name: deface
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
19
+ version: 2.4.0
20
+ - - "<"
32
21
  - !ruby/object:Gem::Version
33
- version: '1.0'
22
+ version: '4'
34
23
  type: :runtime
35
24
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.0'
41
- - !ruby/object:Gem::Dependency
42
- name: sqlite3
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 1.3.10
48
- type: :development
49
- prerelease: false
50
25
  version_requirements: !ruby/object:Gem::Requirement
51
26
  requirements:
52
27
  - - ">="
53
28
  - !ruby/object:Gem::Version
54
- version: 1.3.10
55
- - !ruby/object:Gem::Dependency
56
- name: capybara
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.4'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
29
+ version: 2.4.0
30
+ - - "<"
67
31
  - !ruby/object:Gem::Version
68
- version: '2.4'
32
+ version: '4'
69
33
  - !ruby/object:Gem::Dependency
70
- name: ffaker
34
+ name: coffee-rails
71
35
  requirement: !ruby/object:Gem::Requirement
72
36
  requirements:
73
37
  - - ">="
74
38
  - !ruby/object:Gem::Version
75
- version: 1.32.1
76
- type: :development
39
+ version: '0'
40
+ type: :runtime
77
41
  prerelease: false
78
42
  version_requirements: !ruby/object:Gem::Requirement
79
43
  requirements:
80
44
  - - ">="
81
45
  - !ruby/object:Gem::Version
82
- version: 1.32.1
46
+ version: '0'
83
47
  - !ruby/object:Gem::Dependency
84
- name: shoulda-matchers
48
+ name: deface
85
49
  requirement: !ruby/object:Gem::Requirement
86
50
  requirements:
87
51
  - - ">="
88
52
  - !ruby/object:Gem::Version
89
53
  version: '0'
90
- type: :development
54
+ type: :runtime
91
55
  prerelease: false
92
56
  version_requirements: !ruby/object:Gem::Requirement
93
57
  requirements:
@@ -95,172 +59,130 @@ dependencies:
95
59
  - !ruby/object:Gem::Version
96
60
  version: '0'
97
61
  - !ruby/object:Gem::Dependency
98
- name: rspec-rails
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '3.2'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '3.2'
111
- - !ruby/object:Gem::Dependency
112
- name: simplecov
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '0.9'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '0.9'
125
- - !ruby/object:Gem::Dependency
126
- name: factory_girl
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '4.5'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '4.5'
139
- - !ruby/object:Gem::Dependency
140
- name: pry-rails
62
+ name: sassc-rails
141
63
  requirement: !ruby/object:Gem::Requirement
142
64
  requirements:
143
65
  - - ">="
144
66
  - !ruby/object:Gem::Version
145
- version: '0.3'
146
- type: :development
67
+ version: '0'
68
+ type: :runtime
147
69
  prerelease: false
148
70
  version_requirements: !ruby/object:Gem::Requirement
149
71
  requirements:
150
72
  - - ">="
151
73
  - !ruby/object:Gem::Version
152
- version: '0.3'
74
+ version: '0'
153
75
  - !ruby/object:Gem::Dependency
154
- name: poltergeist
76
+ name: solidus_core
155
77
  requirement: !ruby/object:Gem::Requirement
156
78
  requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '1.6'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
79
+ - - ">="
165
80
  - !ruby/object:Gem::Version
166
- version: '1.6'
167
- - !ruby/object:Gem::Dependency
168
- name: database_cleaner
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
81
+ version: 2.4.0
82
+ - - "<"
172
83
  - !ruby/object:Gem::Version
173
- version: '1.4'
174
- type: :development
84
+ version: '4'
85
+ type: :runtime
175
86
  prerelease: false
176
87
  version_requirements: !ruby/object:Gem::Requirement
177
88
  requirements:
178
- - - "~>"
89
+ - - ">="
179
90
  - !ruby/object:Gem::Version
180
- version: '1.4'
91
+ version: 2.4.0
92
+ - - "<"
93
+ - !ruby/object:Gem::Version
94
+ version: '4'
181
95
  - !ruby/object:Gem::Dependency
182
- name: coffee-rails
96
+ name: solidus_support
183
97
  requirement: !ruby/object:Gem::Requirement
184
98
  requirements:
185
99
  - - "~>"
186
100
  - !ruby/object:Gem::Version
187
- version: '4.0'
188
- type: :development
101
+ version: '0.8'
102
+ type: :runtime
189
103
  prerelease: false
190
104
  version_requirements: !ruby/object:Gem::Requirement
191
105
  requirements:
192
106
  - - "~>"
193
107
  - !ruby/object:Gem::Version
194
- version: '4.0'
108
+ version: '0.8'
195
109
  - !ruby/object:Gem::Dependency
196
- name: sass-rails
110
+ name: shoulda-matchers
197
111
  requirement: !ruby/object:Gem::Requirement
198
112
  requirements:
199
- - - "~>"
113
+ - - ">="
200
114
  - !ruby/object:Gem::Version
201
- version: '5.0'
115
+ version: '0'
202
116
  type: :development
203
117
  prerelease: false
204
118
  version_requirements: !ruby/object:Gem::Requirement
205
119
  requirements:
206
- - - "~>"
120
+ - - ">="
207
121
  - !ruby/object:Gem::Version
208
- version: '5.0'
122
+ version: '0'
209
123
  - !ruby/object:Gem::Dependency
210
- name: rubocop
124
+ name: solidus_dev_support
211
125
  requirement: !ruby/object:Gem::Requirement
212
126
  requirements:
213
127
  - - ">="
214
128
  - !ruby/object:Gem::Version
215
- version: 0.24.1
129
+ version: '0'
216
130
  type: :development
217
131
  prerelease: false
218
132
  version_requirements: !ruby/object:Gem::Requirement
219
133
  requirements:
220
134
  - - ">="
221
135
  - !ruby/object:Gem::Version
222
- version: 0.24.1
136
+ version: '0'
223
137
  description: Allow prices to be configured in quantity ranges for each variant
224
138
  email: sean@railsdog.com
225
139
  executables: []
226
140
  extensions: []
227
141
  extra_rdoc_files: []
228
142
  files:
143
+ - ".circleci/config.yml"
144
+ - ".gem_release.yml"
145
+ - ".github/dependabot.yml"
146
+ - ".github/stale.yml"
229
147
  - ".gitignore"
230
- - ".hound.yml"
231
148
  - ".rspec"
232
149
  - ".rubocop.yml"
233
- - ".travis.yml"
234
- - CONTRIBUTING.md
150
+ - ".rubocop_todo.yml"
151
+ - CHANGELOG.md
235
152
  - Gemfile
236
153
  - Guardfile
237
- - LICENSE.md
154
+ - LICENSE
238
155
  - README.md
239
156
  - Rakefile
240
157
  - app/assets/javascripts/spree/backend/solidus_volume_pricing.js
241
- - app/controllers/spree/admin/variants_controller_decorator.rb
242
158
  - app/controllers/spree/admin/volume_price_models_controller.rb
243
159
  - app/controllers/spree/admin/volume_prices_controller.rb
244
- - app/helpers/spree/base_helper_decorator.rb
245
- - app/models/spree/line_item_decorator.rb
246
- - app/models/spree/user_decorator.rb
247
- - app/models/spree/variant_decorator.rb
160
+ - app/decorators/controllers/solidus_volume_pricing/spree/admin/variants_controller_decorator.rb
161
+ - app/decorators/helpers/solidus_volume_pricing/spree/base_helper_decorator.rb
162
+ - app/decorators/models/solidus_volume_pricing/spree/line_item_decorator.rb
163
+ - app/decorators/models/solidus_volume_pricing/spree/variant_decorator.rb
164
+ - app/models/solidus_volume_pricing/price_display.rb
165
+ - app/models/solidus_volume_pricing/pricer.rb
166
+ - app/models/solidus_volume_pricing/pricing_options.rb
248
167
  - app/models/spree/volume_price.rb
249
168
  - app/models/spree/volume_price_model.rb
250
- - app/overrides/spree/admin/shared/sub_menu/_configuration/add_volume_price_model_admin_menu_links.html.erb.deface
169
+ - app/overrides/spree/admin/shared/_settings_sub_menu/add_volume_price_model_admin_menu_links.html.erb.deface
251
170
  - app/overrides/views_decorator.rb
252
171
  - app/views/spree/admin/shared/_vp_product_tab.html.erb
253
172
  - app/views/spree/admin/variants/_edit_fields.html.erb
254
173
  - app/views/spree/admin/variants/volume_prices.html.erb
255
174
  - app/views/spree/admin/volume_price_models/_form.html.erb
256
175
  - app/views/spree/admin/volume_price_models/_list.html.erb
176
+ - app/views/spree/admin/volume_price_models/_select.html.erb
257
177
  - app/views/spree/admin/volume_price_models/edit.html.erb
258
178
  - app/views/spree/admin/volume_price_models/index.html.erb
259
179
  - app/views/spree/admin/volume_price_models/new.html.erb
260
- - app/views/spree/admin/volume_prices/_edit_fields.html.erb
180
+ - app/views/spree/admin/volume_prices/_table.html.erb
261
181
  - app/views/spree/admin/volume_prices/_volume_price_fields.html.erb
262
182
  - app/views/spree/products/_volume_pricing.html.erb
183
+ - bin/console
263
184
  - bin/rails
185
+ - bin/setup
264
186
  - config/locales/de.yml
265
187
  - config/locales/en.yml
266
188
  - config/locales/pt.yml
@@ -277,27 +199,30 @@ files:
277
199
  - lib/generators/solidus_volume_pricing/install/install_generator.rb
278
200
  - lib/solidus_volume_pricing.rb
279
201
  - lib/solidus_volume_pricing/engine.rb
202
+ - lib/solidus_volume_pricing/range_from_string.rb
203
+ - lib/solidus_volume_pricing/testing_support/factories.rb
280
204
  - lib/solidus_volume_pricing/version.rb
281
205
  - solidus_volume_pricing.gemspec
282
206
  - spec/controllers/spree/admin/variants_controller_spec.rb
283
- - spec/factories/volume_price_factory.rb
284
207
  - spec/features/manage_volume_price_models_feature_spec.rb
285
208
  - spec/features/manage_volume_prices_feature_spec.rb
286
209
  - spec/helpers/base_helper_spec.rb
210
+ - spec/lib/solidus_volume_pricing/range_from_string_spec.rb
211
+ - spec/models/solidus_volume_pricing/pricer_spec.rb
212
+ - spec/models/solidus_volume_pricing/pricing_options_spec.rb
287
213
  - spec/models/spree/line_item_spec.rb
288
214
  - spec/models/spree/order_spec.rb
289
215
  - spec/models/spree/variant_spec.rb
290
216
  - spec/models/spree/volume_price_spec.rb
291
217
  - spec/spec_helper.rb
292
- - spec/support/capybara.rb
293
- - spec/support/database_cleaner.rb
294
- - spec/support/factory_girl.rb
295
- - spec/support/spree.rb
218
+ - spec/support/shoulda.rb
296
219
  homepage: https://github.com/solidusio-contrib/solidus_volume_pricing
297
220
  licenses:
298
- - BSD-3
299
- metadata: {}
300
- post_install_message:
221
+ - BSD-3-Clause
222
+ metadata:
223
+ homepage_uri: https://github.com/solidusio-contrib/solidus_volume_pricing
224
+ source_code_uri: https://github.com/solidusio-contrib/solidus_volume_pricing
225
+ post_install_message:
301
226
  rdoc_options: []
302
227
  require_paths:
303
228
  - lib
@@ -305,31 +230,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
305
230
  requirements:
306
231
  - - ">="
307
232
  - !ruby/object:Gem::Version
308
- version: 2.2.3
233
+ version: '2.5'
309
234
  required_rubygems_version: !ruby/object:Gem::Requirement
310
235
  requirements:
311
236
  - - ">="
312
237
  - !ruby/object:Gem::Version
313
238
  version: '0'
314
- requirements:
315
- - none
316
- rubyforge_project:
317
- rubygems_version: 2.5.2
318
- signing_key:
239
+ requirements: []
240
+ rubygems_version: 3.3.7
241
+ signing_key:
319
242
  specification_version: 4
320
243
  summary: Allow prices to be configured in quantity ranges for each variant
321
244
  test_files:
322
245
  - spec/controllers/spree/admin/variants_controller_spec.rb
323
- - spec/factories/volume_price_factory.rb
324
246
  - spec/features/manage_volume_price_models_feature_spec.rb
325
247
  - spec/features/manage_volume_prices_feature_spec.rb
326
248
  - spec/helpers/base_helper_spec.rb
249
+ - spec/lib/solidus_volume_pricing/range_from_string_spec.rb
250
+ - spec/models/solidus_volume_pricing/pricer_spec.rb
251
+ - spec/models/solidus_volume_pricing/pricing_options_spec.rb
327
252
  - spec/models/spree/line_item_spec.rb
328
253
  - spec/models/spree/order_spec.rb
329
254
  - spec/models/spree/variant_spec.rb
330
255
  - spec/models/spree/volume_price_spec.rb
331
256
  - spec/spec_helper.rb
332
- - spec/support/capybara.rb
333
- - spec/support/database_cleaner.rb
334
- - spec/support/factory_girl.rb
335
- - spec/support/spree.rb
257
+ - spec/support/shoulda.rb
data/.hound.yml DELETED
@@ -1,40 +0,0 @@
1
- ---
2
- # Too picky.
3
- Metrics/LineLength:
4
- Enabled: false
5
-
6
- Metrics/AbcSize:
7
- Enabled: false
8
-
9
- # This should truly be on for well documented gems.
10
- Style/Documentation:
11
- Enabled: false
12
-
13
- # Neatly aligned code is too swell.
14
- Style/SingleSpaceBeforeFirstArg:
15
- Enabled: false
16
-
17
- # Don't mess with RSpec DSL.
18
- Style/BlockDelimiters:
19
- Exclude:
20
- - 'spec/**/*'
21
-
22
- # We really like the readability with newline in beginning of classes.
23
- Style/EmptyLinesAroundBlockBody:
24
- Enabled: false
25
-
26
- Style/EmptyLinesAroundClassBody:
27
- Enabled: false
28
-
29
- # It say we should use fail over raise.
30
- Style/SignalException:
31
- Enabled: false
32
-
33
- # Use nested module/class definitions instead of compact style.
34
- # Too high git impact to change this now.
35
- Style/ClassAndModuleChildren:
36
- Enabled: false
37
-
38
- # Avoid contradictory style rules by enforce single quotes.
39
- Style/StringLiterals:
40
- EnforcedStyle: single_quotes
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.3
4
- sudo: false
5
- cache: bundler
6
- only: master
7
- env:
8
- matrix:
9
- - SOLIDUS_BRANCH=v1.3 DB=mysql
10
- - SOLIDUS_BRANCH=v1.3 DB=postgresql
11
- - SOLIDUS_BRANCH=v1.4 DB=mysql
12
- - SOLIDUS_BRANCH=v1.4 DB=postgresql
data/CONTRIBUTING.md DELETED
@@ -1,81 +0,0 @@
1
- # Contributing
2
-
3
- Spree Reviews is an open source project and we encourage contributions. Please see the [contributors guidelines](http://spreecommerce.com/documentation/contributing_to_spree.html) for more information before contributing.
4
-
5
- In the spirit of [free software][1], **everyone** is encouraged to help improve this project.
6
-
7
- Here are some ways *you* can contribute:
8
-
9
- * by using prerelease versions
10
- * by reporting [bugs][2]
11
- * by suggesting new features
12
- * by writing [translations][3]
13
- * by writing or editing documentation
14
- * by writing specifications
15
- * by writing code (*no patch is too small*: fix typos, add comments, clean up inconsistent whitespace)
16
- * by refactoring code
17
- * by resolving [issues][2]
18
- * by reviewing patches
19
-
20
- ---
21
-
22
- ## Filing an issue
23
-
24
- When filing an issue on this extension, please first do these things:
25
-
26
- * Verify you can reproduce this issue in a brand new application.
27
- * Run through the steps to reproduce the issue again.
28
-
29
- In the issue itself please provide:
30
-
31
- * A comprehensive list of steps to reproduce the issue.
32
- * What you're *expecting* to happen compared with what's *actually* happening.
33
- * The version of Spree *and* the version of Rails.
34
- * A list of all extensions.
35
- * Any relevant stack traces ("Full trace" preferred)
36
- * Your `Gemfile`
37
-
38
- In 99% of cases, this information is enough to determine the cause and solution to the problem that is being described.
39
-
40
- ---
41
-
42
- ## Pull requests
43
-
44
- We gladly accept pull requests to fix bugs and, in some circumstances, add new features to this extension.
45
-
46
- Here's a quick guide:
47
-
48
- 1. Fork the repo.
49
-
50
- 2. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate.
51
-
52
- 3. Create new branch then make changes and add tests for your changes. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, we need tests!
53
-
54
- 4. Push to your fork and submit a pull request. If the changes will apply cleanly to the latest stable branches and master branch, you will only need to submit one pull request.
55
-
56
- At this point you're waiting on us. We may suggest some changes or improvements or alternatives.
57
-
58
- Some things that will increase the chance that your pull request is accepted, taken straight from the Ruby on Rails guide:
59
-
60
- * Use Rails idioms and helpers.
61
- * Include tests that fail without your code, and pass with it.
62
- * Update the documentation, the surrounding one, examples elsewhere, guides, whatever is affected by your contribution.
63
-
64
- ---
65
-
66
- ## TL;DR
67
-
68
- * Fork the repo
69
- * Clone your repo
70
- * Run `bundle install`
71
- * Run `bundle exec rake test_app` to create the test application in `spec/dummy`
72
- * Make your changes
73
- * Ensure specs pass by running `bundle exec rspec spec`
74
- * Ensure all syntax ok by running `rubocop .`
75
- * Submit your pull request
76
-
77
- And in case we didn't emphasize it enough: **we love tests!**
78
-
79
- [1]: http://www.fsf.org/licensing/essays/free-sw.html
80
- [2]: https://github.com/solidusio-contrib/solidus_volume_pricing/issues
81
- [3]: https://github.com/solidusio-contrib/solidus_volume_pricing/tree/master/config/locales
@@ -1,32 +0,0 @@
1
- Spree::Admin::VariantsController.class_eval do
2
-
3
- def edit
4
- @variant.volume_prices.build if @variant.volume_prices.empty?
5
- super
6
- end
7
-
8
- def volume_prices
9
- @product = @variant.product
10
- @variant.volume_prices.build if @variant.volume_prices.empty?
11
- end
12
-
13
- private
14
-
15
- # this loads the variant for the master variant volume price editing
16
- def load_resource_instance
17
- parent
18
-
19
- if new_actions.include?(params[:action].to_sym)
20
- build_resource
21
- elsif params[:id]
22
- Spree::Variant.find(params[:id])
23
- end
24
- end
25
-
26
- def location_after_save
27
- if @product.master.id == @variant.id && params[:variant].key?(:volume_prices_attributes)
28
- return volume_prices_admin_product_variant_url(@product, @variant)
29
- end
30
- super
31
- end
32
- end
@@ -1,19 +0,0 @@
1
- Spree::BaseHelper.class_eval do
2
- def display_volume_price(variant, quantity = 1, user = nil)
3
- Spree::Money.new(
4
- variant.volume_price(quantity, user),
5
- currency: Spree::Config[:currency]
6
- ).to_html
7
- end
8
-
9
- def display_volume_price_earning_percent(variant, quantity = 1, user = nil)
10
- variant.volume_price_earning_percent(quantity, user).round.to_s
11
- end
12
-
13
- def display_volume_price_earning_amount(variant, quantity = 1, user = nil)
14
- Spree::Money.new(
15
- variant.volume_price_earning_amount(quantity, user),
16
- currency: Spree::Config[:currency]
17
- ).to_html
18
- end
19
- end
@@ -1,13 +0,0 @@
1
- module Spree
2
- module LineItemPriceUpdater
3
- def set_pricing_attributes
4
- super
5
-
6
- if quantity_changed?
7
- self.price = variant.volume_price(quantity, order.user)
8
- end
9
- end
10
- end
11
- end
12
-
13
- Spree::LineItem.prepend(Spree::LineItemPriceUpdater)