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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.git-blame-ignore-revs +3 -0
  3. data/.github/workflows/lint.yml +25 -0
  4. data/.github/workflows/test.yml +59 -0
  5. data/.rubocop.yml +0 -5
  6. data/Gemfile +21 -23
  7. data/Guardfile +8 -8
  8. data/README.md +1 -1
  9. data/Rakefile +3 -3
  10. data/app/models/solidus_volume_pricing/pricer.rb +9 -9
  11. data/app/models/solidus_volume_pricing/pricing_options.rb +2 -2
  12. data/app/models/spree/volume_price.rb +8 -8
  13. data/app/patches/helpers/solidus_volume_pricing/spree_base_helper_patch.rb +29 -0
  14. data/app/patches/models/solidus_volume_pricing/spree_line_item_patch.rb +18 -0
  15. data/app/patches/models/solidus_volume_pricing/spree_variant_patch.rb +21 -0
  16. data/bin/rails-engine +6 -6
  17. data/bin/rails-sandbox +4 -4
  18. data/config/routes.rb +1 -1
  19. data/db/migrate/20150603143015_create_spree_volume_price_models.rb +2 -2
  20. data/lib/generators/solidus_volume_pricing/install/install_generator.rb +4 -4
  21. data/lib/patches/backend/controllers/solidus_volume_pricing/spree_admin_variants_controller_patch.rb +38 -0
  22. data/lib/solidus_volume_pricing/engine.rb +22 -11
  23. data/lib/solidus_volume_pricing/range_from_string.rb +4 -4
  24. data/lib/solidus_volume_pricing/testing_support/factories.rb +5 -5
  25. data/lib/solidus_volume_pricing/version.rb +1 -1
  26. data/lib/solidus_volume_pricing.rb +9 -9
  27. data/solidus_volume_pricing.gemspec +20 -21
  28. metadata +41 -63
  29. data/.circleci/config.yml +0 -73
  30. data/.rubocop_todo.yml +0 -68
  31. data/app/decorators/controllers/solidus_volume_pricing/spree/admin/variants_controller_decorator.rb +0 -42
  32. data/app/decorators/helpers/solidus_volume_pricing/spree/base_helper_decorator.rb +0 -31
  33. data/app/decorators/models/solidus_volume_pricing/spree/line_item_decorator.rb +0 -18
  34. data/app/decorators/models/solidus_volume_pricing/spree/variant_decorator.rb +0 -23
  35. data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -30
  36. data/spec/features/manage_volume_price_models_feature_spec.rb +0 -24
  37. data/spec/features/manage_volume_prices_feature_spec.rb +0 -33
  38. data/spec/helpers/base_helper_spec.rb +0 -24
  39. data/spec/lib/solidus_volume_pricing/range_from_string_spec.rb +0 -61
  40. data/spec/models/solidus_volume_pricing/pricer_spec.rb +0 -669
  41. data/spec/models/solidus_volume_pricing/pricing_options_spec.rb +0 -57
  42. data/spec/models/spree/line_item_spec.rb +0 -36
  43. data/spec/models/spree/order_spec.rb +0 -51
  44. data/spec/models/spree/variant_spec.rb +0 -6
  45. data/spec/models/spree/volume_price_spec.rb +0 -216
  46. data/spec/spec_helper.rb +0 -32
  47. data/spec/support/shoulda.rb +0 -11
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe Spree::BaseHelper, type: :helper do
4
- include described_class
5
-
6
- context 'volume pricing' do
7
- before do
8
- @variant = create :variant, price: 10
9
- @variant.volume_prices.create! amount: 1, discount_type: 'dollar', range: '(10+)'
10
- end
11
-
12
- it 'gives discounted price' do
13
- expect(display_volume_price(@variant, 10)).to eq '$9.00'
14
- end
15
-
16
- it 'gives discount percent' do
17
- expect(display_volume_price_earning_percent(@variant, 10)).to eq '10'
18
- end
19
-
20
- it 'gives discount amount' do
21
- expect(display_volume_price_earning_amount(@variant, 10)).to eq '$1.00'
22
- end
23
- end
24
- end
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe SolidusVolumePricing::RangeFromString do
6
- describe 'new' do
7
- subject(:range) { described_class.new(argument).to_range }
8
-
9
- context 'with a string with two dots' do
10
- let(:argument) { '1..2' }
11
-
12
- it { is_expected.to eq(1..2) }
13
- end
14
-
15
- context 'with a string with two dots and parens' do
16
- let(:argument) { '(1..2)' }
17
-
18
- it { is_expected.to eq(1..2) }
19
- end
20
-
21
- context 'with a string with three dots' do
22
- let(:argument) { '1...2' }
23
-
24
- it { is_expected.to eq(1...2) }
25
- end
26
-
27
- context 'with a string with three dots and parens' do
28
- let(:argument) { '(1...2)' }
29
-
30
- it { is_expected.to eq(1...2) }
31
- end
32
-
33
- context 'with an open-ended string like x+' do
34
- let(:argument) { '10+' }
35
-
36
- it { is_expected.to eq(10..Float::INFINITY) }
37
- end
38
-
39
- context 'with an open-ended string like x+" and parens' do
40
- let(:argument) { '(10+)' }
41
-
42
- it { is_expected.to eq(10..Float::INFINITY) }
43
- end
44
-
45
- context 'with invalid input' do
46
- let(:argument) { 'system("rm -rf /*")' }
47
-
48
- it do
49
- expect { subject }.to raise_error(ArgumentError)
50
- end
51
- end
52
-
53
- context 'with invalid input' do
54
- let(:argument) { '1..3; puts "Do not run Ruby Code"' }
55
-
56
- it do
57
- expect { subject }.to raise_error(ArgumentError)
58
- end
59
- end
60
- end
61
- end