solidus_volume_pricing 1.2.0 → 2.0.0
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.
- checksums.yaml +4 -4
- data/.git-blame-ignore-revs +3 -0
- data/.github/workflows/lint.yml +25 -0
- data/.github/workflows/test.yml +59 -0
- data/.rubocop.yml +0 -5
- data/Gemfile +21 -23
- data/Guardfile +8 -8
- data/README.md +1 -1
- data/Rakefile +3 -3
- data/app/models/solidus_volume_pricing/pricer.rb +9 -9
- data/app/models/solidus_volume_pricing/pricing_options.rb +2 -2
- data/app/models/spree/volume_price.rb +8 -8
- data/app/patches/helpers/solidus_volume_pricing/spree_base_helper_patch.rb +29 -0
- data/app/patches/models/solidus_volume_pricing/spree_line_item_patch.rb +18 -0
- data/app/patches/models/solidus_volume_pricing/spree_variant_patch.rb +21 -0
- data/bin/rails-engine +6 -6
- data/bin/rails-sandbox +4 -4
- data/config/routes.rb +1 -1
- data/db/migrate/20150603143015_create_spree_volume_price_models.rb +2 -2
- data/lib/generators/solidus_volume_pricing/install/install_generator.rb +4 -4
- data/lib/patches/backend/controllers/solidus_volume_pricing/spree_admin_variants_controller_patch.rb +38 -0
- data/lib/solidus_volume_pricing/engine.rb +22 -11
- data/lib/solidus_volume_pricing/range_from_string.rb +4 -4
- data/lib/solidus_volume_pricing/testing_support/factories.rb +5 -5
- data/lib/solidus_volume_pricing/version.rb +1 -1
- data/lib/solidus_volume_pricing.rb +9 -9
- data/solidus_volume_pricing.gemspec +20 -21
- metadata +41 -63
- data/.circleci/config.yml +0 -73
- data/.rubocop_todo.yml +0 -68
- data/app/decorators/controllers/solidus_volume_pricing/spree/admin/variants_controller_decorator.rb +0 -42
- data/app/decorators/helpers/solidus_volume_pricing/spree/base_helper_decorator.rb +0 -31
- data/app/decorators/models/solidus_volume_pricing/spree/line_item_decorator.rb +0 -18
- data/app/decorators/models/solidus_volume_pricing/spree/variant_decorator.rb +0 -23
- data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -30
- data/spec/features/manage_volume_price_models_feature_spec.rb +0 -24
- data/spec/features/manage_volume_prices_feature_spec.rb +0 -33
- data/spec/helpers/base_helper_spec.rb +0 -24
- data/spec/lib/solidus_volume_pricing/range_from_string_spec.rb +0 -61
- data/spec/models/solidus_volume_pricing/pricer_spec.rb +0 -669
- data/spec/models/solidus_volume_pricing/pricing_options_spec.rb +0 -57
- data/spec/models/spree/line_item_spec.rb +0 -36
- data/spec/models/spree/order_spec.rb +0 -51
- data/spec/models/spree/variant_spec.rb +0 -6
- data/spec/models/spree/volume_price_spec.rb +0 -216
- data/spec/spec_helper.rb +0 -32
- data/spec/support/shoulda.rb +0 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
require
|
|
9
|
-
require
|
|
10
|
-
require
|
|
11
|
-
require
|
|
3
|
+
require "active_support/deprecation"
|
|
4
|
+
require "sassc/rails"
|
|
5
|
+
require "deface"
|
|
6
|
+
require "solidus_core"
|
|
7
|
+
require "solidus_support"
|
|
8
|
+
require "solidus_volume_pricing/engine"
|
|
9
|
+
require "solidus_volume_pricing/version"
|
|
10
|
+
require "solidus_volume_pricing/range_from_string"
|
|
11
|
+
require "coffee_script"
|
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative "lib/solidus_volume_pricing/version"
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name =
|
|
6
|
+
spec.name = "solidus_volume_pricing"
|
|
7
7
|
spec.version = SolidusVolumePricing::VERSION
|
|
8
|
-
spec.authors = [
|
|
9
|
-
spec.email =
|
|
8
|
+
spec.authors = ["Sean Schofield"]
|
|
9
|
+
spec.email = "sean@railsdog.com"
|
|
10
10
|
|
|
11
|
-
spec.summary =
|
|
12
|
-
spec.description =
|
|
13
|
-
spec.homepage =
|
|
14
|
-
spec.license =
|
|
11
|
+
spec.summary = "Allow prices to be configured in quantity ranges for each variant"
|
|
12
|
+
spec.description = "Allow prices to be configured in quantity ranges for each variant"
|
|
13
|
+
spec.homepage = "https://github.com/solidusio-contrib/solidus_volume_pricing"
|
|
14
|
+
spec.license = "BSD-3-Clause"
|
|
15
15
|
|
|
16
|
-
spec.metadata[
|
|
17
|
-
spec.metadata[
|
|
18
|
-
spec.metadata[
|
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/solidusio-contrib/solidus_volume_pricing"
|
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/solidusio-contrib/solidus_volume_pricing/releases"
|
|
19
19
|
|
|
20
|
-
spec.required_ruby_version = Gem::Requirement.new(
|
|
20
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.0", "< 4")
|
|
21
21
|
|
|
22
22
|
# Specify which files should be added to the gem when it is released.
|
|
23
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
24
|
files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
|
|
25
25
|
|
|
26
26
|
spec.files = files.grep_v(%r{^(test|spec|features)/})
|
|
27
|
-
spec.test_files = files.grep(%r{^(test|spec|features)/})
|
|
28
27
|
spec.bindir = "exe"
|
|
29
28
|
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
30
29
|
spec.require_paths = ["lib"]
|
|
31
30
|
|
|
32
|
-
spec.
|
|
33
|
-
spec.add_dependency
|
|
34
|
-
spec.add_dependency
|
|
35
|
-
spec.add_dependency
|
|
36
|
-
spec.add_dependency
|
|
37
|
-
spec.add_dependency
|
|
31
|
+
spec.add_dependency "solidus_backend", [">= 4.0", "< 5"]
|
|
32
|
+
spec.add_dependency "solidus_core", [">= 4.0", "< 5"]
|
|
33
|
+
spec.add_dependency "solidus_support", [">= 0.15.0", "< 1"]
|
|
34
|
+
spec.add_dependency "coffee-rails"
|
|
35
|
+
spec.add_dependency "deface"
|
|
36
|
+
spec.add_dependency "sassc-rails"
|
|
38
37
|
|
|
39
|
-
spec.add_development_dependency
|
|
40
|
-
spec.add_development_dependency
|
|
38
|
+
spec.add_development_dependency "shoulda-matchers"
|
|
39
|
+
spec.add_development_dependency "solidus_dev_support", "~> 2.6"
|
|
41
40
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_volume_pricing
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Schofield
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: solidus_backend
|
|
@@ -16,7 +15,7 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
18
|
+
version: '4.0'
|
|
20
19
|
- - "<"
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
21
|
version: '5'
|
|
@@ -26,40 +25,52 @@ dependencies:
|
|
|
26
25
|
requirements:
|
|
27
26
|
- - ">="
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
28
|
+
version: '4.0'
|
|
30
29
|
- - "<"
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
31
|
version: '5'
|
|
33
32
|
- !ruby/object:Gem::Dependency
|
|
34
|
-
name:
|
|
33
|
+
name: solidus_core
|
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
|
36
35
|
requirements:
|
|
37
36
|
- - ">="
|
|
38
37
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0'
|
|
38
|
+
version: '4.0'
|
|
39
|
+
- - "<"
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '5'
|
|
40
42
|
type: :runtime
|
|
41
43
|
prerelease: false
|
|
42
44
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
45
|
requirements:
|
|
44
46
|
- - ">="
|
|
45
47
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0'
|
|
48
|
+
version: '4.0'
|
|
49
|
+
- - "<"
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '5'
|
|
47
52
|
- !ruby/object:Gem::Dependency
|
|
48
|
-
name:
|
|
53
|
+
name: solidus_support
|
|
49
54
|
requirement: !ruby/object:Gem::Requirement
|
|
50
55
|
requirements:
|
|
51
56
|
- - ">="
|
|
52
57
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
58
|
+
version: 0.15.0
|
|
59
|
+
- - "<"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '1'
|
|
54
62
|
type: :runtime
|
|
55
63
|
prerelease: false
|
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
65
|
requirements:
|
|
58
66
|
- - ">="
|
|
59
67
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
68
|
+
version: 0.15.0
|
|
69
|
+
- - "<"
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: '1'
|
|
61
72
|
- !ruby/object:Gem::Dependency
|
|
62
|
-
name:
|
|
73
|
+
name: coffee-rails
|
|
63
74
|
requirement: !ruby/object:Gem::Requirement
|
|
64
75
|
requirements:
|
|
65
76
|
- - ">="
|
|
@@ -73,39 +84,33 @@ dependencies:
|
|
|
73
84
|
- !ruby/object:Gem::Version
|
|
74
85
|
version: '0'
|
|
75
86
|
- !ruby/object:Gem::Dependency
|
|
76
|
-
name:
|
|
87
|
+
name: deface
|
|
77
88
|
requirement: !ruby/object:Gem::Requirement
|
|
78
89
|
requirements:
|
|
79
90
|
- - ">="
|
|
80
91
|
- !ruby/object:Gem::Version
|
|
81
|
-
version:
|
|
82
|
-
- - "<"
|
|
83
|
-
- !ruby/object:Gem::Version
|
|
84
|
-
version: '5'
|
|
92
|
+
version: '0'
|
|
85
93
|
type: :runtime
|
|
86
94
|
prerelease: false
|
|
87
95
|
version_requirements: !ruby/object:Gem::Requirement
|
|
88
96
|
requirements:
|
|
89
97
|
- - ">="
|
|
90
98
|
- !ruby/object:Gem::Version
|
|
91
|
-
version:
|
|
92
|
-
- - "<"
|
|
93
|
-
- !ruby/object:Gem::Version
|
|
94
|
-
version: '5'
|
|
99
|
+
version: '0'
|
|
95
100
|
- !ruby/object:Gem::Dependency
|
|
96
|
-
name:
|
|
101
|
+
name: sassc-rails
|
|
97
102
|
requirement: !ruby/object:Gem::Requirement
|
|
98
103
|
requirements:
|
|
99
|
-
- - "
|
|
104
|
+
- - ">="
|
|
100
105
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: '0
|
|
106
|
+
version: '0'
|
|
102
107
|
type: :runtime
|
|
103
108
|
prerelease: false
|
|
104
109
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
110
|
requirements:
|
|
106
|
-
- - "
|
|
111
|
+
- - ">="
|
|
107
112
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: '0
|
|
113
|
+
version: '0'
|
|
109
114
|
- !ruby/object:Gem::Dependency
|
|
110
115
|
name: shoulda-matchers
|
|
111
116
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -140,15 +145,16 @@ executables: []
|
|
|
140
145
|
extensions: []
|
|
141
146
|
extra_rdoc_files: []
|
|
142
147
|
files:
|
|
143
|
-
- ".circleci/config.yml"
|
|
144
148
|
- ".gem_release.yml"
|
|
149
|
+
- ".git-blame-ignore-revs"
|
|
145
150
|
- ".github/dependabot.yml"
|
|
146
151
|
- ".github/stale.yml"
|
|
152
|
+
- ".github/workflows/lint.yml"
|
|
153
|
+
- ".github/workflows/test.yml"
|
|
147
154
|
- ".github_changelog_generator"
|
|
148
155
|
- ".gitignore"
|
|
149
156
|
- ".rspec"
|
|
150
157
|
- ".rubocop.yml"
|
|
151
|
-
- ".rubocop_todo.yml"
|
|
152
158
|
- CHANGELOG.md
|
|
153
159
|
- Gemfile
|
|
154
160
|
- Guardfile
|
|
@@ -159,10 +165,6 @@ files:
|
|
|
159
165
|
- app/assets/javascripts/spree/backend/solidus_volume_pricing.js
|
|
160
166
|
- app/controllers/spree/admin/volume_price_models_controller.rb
|
|
161
167
|
- app/controllers/spree/admin/volume_prices_controller.rb
|
|
162
|
-
- app/decorators/controllers/solidus_volume_pricing/spree/admin/variants_controller_decorator.rb
|
|
163
|
-
- app/decorators/helpers/solidus_volume_pricing/spree/base_helper_decorator.rb
|
|
164
|
-
- app/decorators/models/solidus_volume_pricing/spree/line_item_decorator.rb
|
|
165
|
-
- app/decorators/models/solidus_volume_pricing/spree/variant_decorator.rb
|
|
166
168
|
- app/models/solidus_volume_pricing/price_display.rb
|
|
167
169
|
- app/models/solidus_volume_pricing/pricer.rb
|
|
168
170
|
- app/models/solidus_volume_pricing/pricing_options.rb
|
|
@@ -171,6 +173,9 @@ files:
|
|
|
171
173
|
- app/overrides/spree/admin/shared/_product_tabs/add_volume_pricing_admin_tab.html.erb.deface
|
|
172
174
|
- app/overrides/spree/admin/shared/_settings_sub_menu/add_volume_price_model_admin_menu_links.html.erb.deface
|
|
173
175
|
- app/overrides/spree/admin/variants/edit/add_volume_pricing_field_to_variant.html.erb.deface
|
|
176
|
+
- app/patches/helpers/solidus_volume_pricing/spree_base_helper_patch.rb
|
|
177
|
+
- app/patches/models/solidus_volume_pricing/spree_line_item_patch.rb
|
|
178
|
+
- app/patches/models/solidus_volume_pricing/spree_variant_patch.rb
|
|
174
179
|
- app/views/spree/admin/shared/_vp_product_tab.html.erb
|
|
175
180
|
- app/views/spree/admin/variants/_edit_fields.html.erb
|
|
176
181
|
- app/views/spree/admin/variants/volume_prices.html.erb
|
|
@@ -204,25 +209,13 @@ files:
|
|
|
204
209
|
- db/migrate/20150513200904_add_role_to_volume_price.rb
|
|
205
210
|
- db/migrate/20150603143015_create_spree_volume_price_models.rb
|
|
206
211
|
- lib/generators/solidus_volume_pricing/install/install_generator.rb
|
|
212
|
+
- lib/patches/backend/controllers/solidus_volume_pricing/spree_admin_variants_controller_patch.rb
|
|
207
213
|
- lib/solidus_volume_pricing.rb
|
|
208
214
|
- lib/solidus_volume_pricing/engine.rb
|
|
209
215
|
- lib/solidus_volume_pricing/range_from_string.rb
|
|
210
216
|
- lib/solidus_volume_pricing/testing_support/factories.rb
|
|
211
217
|
- lib/solidus_volume_pricing/version.rb
|
|
212
218
|
- solidus_volume_pricing.gemspec
|
|
213
|
-
- spec/controllers/spree/admin/variants_controller_spec.rb
|
|
214
|
-
- spec/features/manage_volume_price_models_feature_spec.rb
|
|
215
|
-
- spec/features/manage_volume_prices_feature_spec.rb
|
|
216
|
-
- spec/helpers/base_helper_spec.rb
|
|
217
|
-
- spec/lib/solidus_volume_pricing/range_from_string_spec.rb
|
|
218
|
-
- spec/models/solidus_volume_pricing/pricer_spec.rb
|
|
219
|
-
- spec/models/solidus_volume_pricing/pricing_options_spec.rb
|
|
220
|
-
- spec/models/spree/line_item_spec.rb
|
|
221
|
-
- spec/models/spree/order_spec.rb
|
|
222
|
-
- spec/models/spree/variant_spec.rb
|
|
223
|
-
- spec/models/spree/volume_price_spec.rb
|
|
224
|
-
- spec/spec_helper.rb
|
|
225
|
-
- spec/support/shoulda.rb
|
|
226
219
|
homepage: https://github.com/solidusio-contrib/solidus_volume_pricing
|
|
227
220
|
licenses:
|
|
228
221
|
- BSD-3-Clause
|
|
@@ -230,7 +223,6 @@ metadata:
|
|
|
230
223
|
homepage_uri: https://github.com/solidusio-contrib/solidus_volume_pricing
|
|
231
224
|
source_code_uri: https://github.com/solidusio-contrib/solidus_volume_pricing
|
|
232
225
|
changelog_uri: https://github.com/solidusio-contrib/solidus_volume_pricing/releases
|
|
233
|
-
post_install_message:
|
|
234
226
|
rdoc_options: []
|
|
235
227
|
require_paths:
|
|
236
228
|
- lib
|
|
@@ -238,7 +230,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
238
230
|
requirements:
|
|
239
231
|
- - ">="
|
|
240
232
|
- !ruby/object:Gem::Version
|
|
241
|
-
version: '
|
|
233
|
+
version: '3.0'
|
|
242
234
|
- - "<"
|
|
243
235
|
- !ruby/object:Gem::Version
|
|
244
236
|
version: '4'
|
|
@@ -248,21 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
248
240
|
- !ruby/object:Gem::Version
|
|
249
241
|
version: '0'
|
|
250
242
|
requirements: []
|
|
251
|
-
rubygems_version: 3.
|
|
252
|
-
signing_key:
|
|
243
|
+
rubygems_version: 3.6.9
|
|
253
244
|
specification_version: 4
|
|
254
245
|
summary: Allow prices to be configured in quantity ranges for each variant
|
|
255
|
-
test_files:
|
|
256
|
-
- spec/controllers/spree/admin/variants_controller_spec.rb
|
|
257
|
-
- spec/features/manage_volume_price_models_feature_spec.rb
|
|
258
|
-
- spec/features/manage_volume_prices_feature_spec.rb
|
|
259
|
-
- spec/helpers/base_helper_spec.rb
|
|
260
|
-
- spec/lib/solidus_volume_pricing/range_from_string_spec.rb
|
|
261
|
-
- spec/models/solidus_volume_pricing/pricer_spec.rb
|
|
262
|
-
- spec/models/solidus_volume_pricing/pricing_options_spec.rb
|
|
263
|
-
- spec/models/spree/line_item_spec.rb
|
|
264
|
-
- spec/models/spree/order_spec.rb
|
|
265
|
-
- spec/models/spree/variant_spec.rb
|
|
266
|
-
- spec/models/spree/volume_price_spec.rb
|
|
267
|
-
- spec/spec_helper.rb
|
|
268
|
-
- spec/support/shoulda.rb
|
|
246
|
+
test_files: []
|
data/.circleci/config.yml
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
version: 2.1
|
|
2
|
-
|
|
3
|
-
orbs:
|
|
4
|
-
# Required for feature specs.
|
|
5
|
-
browser-tools: circleci/browser-tools@1.1
|
|
6
|
-
|
|
7
|
-
# Always take the latest version of the orb, this allows us to
|
|
8
|
-
# run specs against Solidus supported versions only without the need
|
|
9
|
-
# to change this configuration every time a Solidus version is released
|
|
10
|
-
# or goes EOL.
|
|
11
|
-
solidusio_extensions: solidusio/extensions@volatile
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
run-specs:
|
|
15
|
-
parameters:
|
|
16
|
-
solidus:
|
|
17
|
-
type: string
|
|
18
|
-
default: main
|
|
19
|
-
db:
|
|
20
|
-
type: string
|
|
21
|
-
default: "postgres"
|
|
22
|
-
ruby:
|
|
23
|
-
type: string
|
|
24
|
-
default: "3.2"
|
|
25
|
-
executor:
|
|
26
|
-
name: solidusio_extensions/<< parameters.db >>
|
|
27
|
-
ruby_version: << parameters.ruby >>
|
|
28
|
-
steps:
|
|
29
|
-
- checkout
|
|
30
|
-
- browser-tools/install-chrome
|
|
31
|
-
- solidusio_extensions/run-tests-solidus-<< parameters.solidus >>
|
|
32
|
-
|
|
33
|
-
lint-code:
|
|
34
|
-
executor:
|
|
35
|
-
name: solidusio_extensions/sqlite
|
|
36
|
-
ruby_version: "3.0"
|
|
37
|
-
steps:
|
|
38
|
-
- solidusio_extensions/lint-code
|
|
39
|
-
|
|
40
|
-
workflows:
|
|
41
|
-
"Run specs on supported Solidus versions":
|
|
42
|
-
jobs:
|
|
43
|
-
- run-specs:
|
|
44
|
-
name: &name "run-specs-solidus-<< matrix.solidus >>-ruby-<< matrix.ruby >>-db-<< matrix.db >>"
|
|
45
|
-
matrix:
|
|
46
|
-
parameters: { solidus: ["main"], ruby: ["3.2"], db: ["postgres"] }
|
|
47
|
-
- run-specs:
|
|
48
|
-
name: *name
|
|
49
|
-
matrix:
|
|
50
|
-
parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
|
|
51
|
-
- run-specs:
|
|
52
|
-
name: *name
|
|
53
|
-
matrix:
|
|
54
|
-
parameters: { solidus: ["older"], ruby: ["3.0"], db: ["sqlite"] }
|
|
55
|
-
- lint-code
|
|
56
|
-
|
|
57
|
-
"Weekly run specs against main":
|
|
58
|
-
triggers:
|
|
59
|
-
- schedule:
|
|
60
|
-
cron: "0 0 * * 4" # every Thursday
|
|
61
|
-
filters:
|
|
62
|
-
branches:
|
|
63
|
-
only:
|
|
64
|
-
- main
|
|
65
|
-
jobs:
|
|
66
|
-
- run-specs:
|
|
67
|
-
name: *name
|
|
68
|
-
matrix:
|
|
69
|
-
parameters: { solidus: ["main"], ruby: ["3.2"], db: ["postgres"] }
|
|
70
|
-
- run-specs:
|
|
71
|
-
name: *name
|
|
72
|
-
matrix:
|
|
73
|
-
parameters: { solidus: ["current"], ruby: ["3.1"], db: ["mysql"] }
|
data/.rubocop_todo.yml
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# This configuration was generated by
|
|
2
|
-
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2023-05-12 15:47:30 UTC using RuboCop version 1.50.2.
|
|
4
|
-
# The point is for the user to remove these configuration records
|
|
5
|
-
# one by one as the offenses are removed from the code base.
|
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
-
|
|
9
|
-
# Offense count: 42
|
|
10
|
-
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
11
|
-
# Prefixes: when, with, without
|
|
12
|
-
RSpec/ContextWording:
|
|
13
|
-
Exclude:
|
|
14
|
-
- 'spec/helpers/base_helper_spec.rb'
|
|
15
|
-
- 'spec/models/solidus_volume_pricing/pricer_spec.rb'
|
|
16
|
-
- 'spec/models/spree/order_spec.rb'
|
|
17
|
-
- 'spec/models/spree/volume_price_spec.rb'
|
|
18
|
-
|
|
19
|
-
# Offense count: 1
|
|
20
|
-
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
|
21
|
-
# Include: **/*_spec*rb*, **/spec/**/*
|
|
22
|
-
RSpec/FilePath:
|
|
23
|
-
Exclude:
|
|
24
|
-
- 'spec/helpers/base_helper_spec.rb'
|
|
25
|
-
|
|
26
|
-
# Offense count: 29
|
|
27
|
-
# Configuration parameters: AssignmentOnly.
|
|
28
|
-
RSpec/InstanceVariable:
|
|
29
|
-
Exclude:
|
|
30
|
-
- 'spec/helpers/base_helper_spec.rb'
|
|
31
|
-
- 'spec/models/spree/order_spec.rb'
|
|
32
|
-
|
|
33
|
-
# Offense count: 5
|
|
34
|
-
RSpec/MultipleExpectations:
|
|
35
|
-
Max: 3
|
|
36
|
-
|
|
37
|
-
# Offense count: 82
|
|
38
|
-
# Configuration parameters: AllowSubject.
|
|
39
|
-
RSpec/MultipleMemoizedHelpers:
|
|
40
|
-
Max: 8
|
|
41
|
-
|
|
42
|
-
# Offense count: 57
|
|
43
|
-
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
|
44
|
-
# SupportedStyles: always, named_only
|
|
45
|
-
RSpec/NamedSubject:
|
|
46
|
-
Exclude:
|
|
47
|
-
- 'spec/lib/solidus_volume_pricing/range_from_string_spec.rb'
|
|
48
|
-
- 'spec/models/solidus_volume_pricing/pricer_spec.rb'
|
|
49
|
-
- 'spec/models/solidus_volume_pricing/pricing_options_spec.rb'
|
|
50
|
-
- 'spec/models/spree/volume_price_spec.rb'
|
|
51
|
-
|
|
52
|
-
# Offense count: 74
|
|
53
|
-
# Configuration parameters: AllowedGroups.
|
|
54
|
-
RSpec/NestedGroups:
|
|
55
|
-
Max: 7
|
|
56
|
-
|
|
57
|
-
# Offense count: 2
|
|
58
|
-
RSpec/RepeatedExampleGroupDescription:
|
|
59
|
-
Exclude:
|
|
60
|
-
- 'spec/lib/solidus_volume_pricing/range_from_string_spec.rb'
|
|
61
|
-
|
|
62
|
-
# Offense count: 2
|
|
63
|
-
# Configuration parameters: IgnoreScopes, Include.
|
|
64
|
-
# Include: app/models/**/*.rb
|
|
65
|
-
Rails/InverseOf:
|
|
66
|
-
Exclude:
|
|
67
|
-
- 'app/models/spree/volume_price.rb'
|
|
68
|
-
- 'app/models/spree/volume_price_model.rb'
|
data/app/decorators/controllers/solidus_volume_pricing/spree/admin/variants_controller_decorator.rb
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module SolidusVolumePricing
|
|
4
|
-
module Spree
|
|
5
|
-
module Admin
|
|
6
|
-
module VariantsControllerDecorator
|
|
7
|
-
def edit
|
|
8
|
-
@variant.volume_prices.build if @variant.volume_prices.empty?
|
|
9
|
-
super
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def volume_prices
|
|
13
|
-
@product = @variant.product
|
|
14
|
-
@variant.volume_prices.build if @variant.volume_prices.empty?
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
# this loads the variant for the master variant volume price editing
|
|
20
|
-
def load_resource_instance
|
|
21
|
-
parent
|
|
22
|
-
|
|
23
|
-
if new_actions.include?(params[:action].to_sym)
|
|
24
|
-
build_resource
|
|
25
|
-
elsif params[:id]
|
|
26
|
-
::Spree::Variant.find(params[:id])
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def location_after_save
|
|
31
|
-
if @product.master.id == @variant.id && params[:variant].key?(:volume_prices_attributes)
|
|
32
|
-
return volume_prices_admin_product_variant_url(@product, @variant)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
super
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
::Spree::Admin::VariantsController.prepend self
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module SolidusVolumePricing
|
|
4
|
-
module Spree
|
|
5
|
-
module BaseHelperDecorator
|
|
6
|
-
def self.prepended(base)
|
|
7
|
-
base.module_eval do
|
|
8
|
-
def display_volume_price(variant, quantity = 1, user = nil)
|
|
9
|
-
price_display(variant, quantity: quantity, user: user).price_string
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def display_volume_price_earning_percent(variant, quantity = 1, user = nil)
|
|
13
|
-
price_display(variant, quantity: quantity, user: user).earning_percent_string
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def display_volume_price_earning_amount(variant, quantity = 1, user = nil)
|
|
17
|
-
price_display(variant, quantity: quantity, user: user).earning_amount_string
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
-
def price_display(variant, quantity:, user:)
|
|
23
|
-
SolidusVolumePricing::PriceDisplay.new(variant, quantity: quantity, user: user)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
::Spree::BaseHelper.prepend self
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module SolidusVolumePricing
|
|
4
|
-
module Spree
|
|
5
|
-
module LineItemDecorator
|
|
6
|
-
def set_pricing_attributes
|
|
7
|
-
if quantity_changed?
|
|
8
|
-
options = SolidusVolumePricing::PricingOptions.from_line_item(self)
|
|
9
|
-
self.money_price = SolidusVolumePricing::Pricer.new(variant).price_for(options)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
super
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
::Spree::LineItem.prepend self
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module SolidusVolumePricing
|
|
4
|
-
module Spree
|
|
5
|
-
module VariantDecorator
|
|
6
|
-
def self.prepended(base)
|
|
7
|
-
base.class_eval do
|
|
8
|
-
has_and_belongs_to_many :volume_price_models
|
|
9
|
-
has_many :volume_prices, -> { order(position: :asc) }, dependent: :destroy
|
|
10
|
-
has_many :model_volume_prices, -> {
|
|
11
|
-
order(position: :asc)
|
|
12
|
-
}, class_name: '::Spree::VolumePrice', through: :volume_price_models, source: :volume_prices
|
|
13
|
-
accepts_nested_attributes_for :volume_prices, allow_destroy: true,
|
|
14
|
-
reject_if: proc { |volume_price|
|
|
15
|
-
volume_price[:amount].blank? && volume_price[:range].blank?
|
|
16
|
-
}
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
::Spree::Variant.prepend self
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RSpec.describe Spree::Admin::VariantsController, type: :controller do
|
|
4
|
-
stub_authorization!
|
|
5
|
-
|
|
6
|
-
describe 'PUT #update' do
|
|
7
|
-
it 'creates a volume price' do
|
|
8
|
-
variant = create :variant
|
|
9
|
-
|
|
10
|
-
expect do
|
|
11
|
-
put :update, params: {
|
|
12
|
-
product_id: variant.product.slug,
|
|
13
|
-
id: variant.id,
|
|
14
|
-
variant: {
|
|
15
|
-
'volume_prices_attributes' => {
|
|
16
|
-
'1335830259720' => {
|
|
17
|
-
'name' => '5-10',
|
|
18
|
-
'discount_type' => 'price',
|
|
19
|
-
'range' => '5..10',
|
|
20
|
-
'amount' => '90',
|
|
21
|
-
'position' => '1',
|
|
22
|
-
'_destroy' => 'false'
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
end.to change(variant.volume_prices, :count).by(1)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe 'Managing volume price models', type: :system do
|
|
6
|
-
stub_authorization!
|
|
7
|
-
|
|
8
|
-
it 'an admin can create and remove volume price models', :js do
|
|
9
|
-
visit spree.admin_volume_price_models_path
|
|
10
|
-
expect(page).to have_content('Volume Price Models')
|
|
11
|
-
|
|
12
|
-
click_on 'New Volume Price Model'
|
|
13
|
-
fill_in 'Name', with: 'Discount'
|
|
14
|
-
within '#volume_prices' do
|
|
15
|
-
fill_in 'volume_price_model_volume_prices_attributes_0_name', with: '5 pieces discount'
|
|
16
|
-
select 'Total price', from: 'volume_price_model_volume_prices_attributes_0_discount_type'
|
|
17
|
-
fill_in 'volume_price_model_volume_prices_attributes_0_range', with: '1..5'
|
|
18
|
-
fill_in 'volume_price_model_volume_prices_attributes_0_amount', with: '1'
|
|
19
|
-
end
|
|
20
|
-
click_on 'Create'
|
|
21
|
-
|
|
22
|
-
expect(page).to have_content('Discount')
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe 'Managing volume prices' do
|
|
6
|
-
stub_authorization!
|
|
7
|
-
|
|
8
|
-
let(:variant) { create(:variant) }
|
|
9
|
-
|
|
10
|
-
it 'an admin can create and remove volume prices', :js do
|
|
11
|
-
visit spree.edit_admin_product_path(variant.product)
|
|
12
|
-
click_on 'Volume Pricing'
|
|
13
|
-
expect(page).to have_content('Volume Prices')
|
|
14
|
-
|
|
15
|
-
fill_in 'variant_volume_prices_attributes_0_name', with: '5 pieces discount'
|
|
16
|
-
select 'Total price', from: 'variant_volume_prices_attributes_0_discount_type'
|
|
17
|
-
fill_in 'variant_volume_prices_attributes_0_range', with: '1..5'
|
|
18
|
-
fill_in 'variant_volume_prices_attributes_0_amount', with: '1'
|
|
19
|
-
click_on 'Update'
|
|
20
|
-
|
|
21
|
-
expect(page).to have_field('variant_volume_prices_attributes_0_name', with: '5 pieces discount')
|
|
22
|
-
accept_confirm { page.find('a[data-action="remove"]').click }
|
|
23
|
-
|
|
24
|
-
expect(page).not_to have_field('variant_volume_prices_attributes_0_name', with: '5 pieces discount')
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it 'an admin editing a variant has a new volume price already built for her' do
|
|
28
|
-
visit spree.edit_admin_product_variant_path(product_id: variant.product, id: variant)
|
|
29
|
-
within '#volume_prices' do
|
|
30
|
-
expect(page).to have_field('variant_volume_prices_attributes_0_name')
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|