spree_core 3.7.2 → 3.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/spree/order.rb +1 -1
- data/app/models/spree/promotion/rules/item_total.rb +1 -1
- data/app/services/spree/checkout/get_shipping_rates.rb +7 -0
- data/config/initializers/state_machine.rb +37 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/testing_support/capybara_ext.rb +8 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d659f0992a4f2aa8af409c5cbd50f1e824b39bae09cc69a107990abf4e557120
|
4
|
+
data.tar.gz: 41babfa431effea64e542e2698f6ed74054e489e5f5075e2841590fd76857b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ca1f7d8862e25123578e339dab67e71259a9572ebb3edb28e7c4e720b5d2f4e34b2accf904aa6cf59468aeb2137cbb38268f22517d4d58efd01d4051b753022
|
7
|
+
data.tar.gz: bf207628a2fbff24f23e7bacf6f357a0b3efc95075e19ec95671a5b667a34fc314c91895e6b8e84f9ab2ed025e18c6314cae77a224e0acf7a759a0fa161a3f72
|
data/app/models/spree/order.rb
CHANGED
@@ -39,7 +39,7 @@ module Spree
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def ineligible_message_max
|
42
|
-
if preferred_operator_max == '
|
42
|
+
if preferred_operator_max == 'lt'
|
43
43
|
eligibility_error_message(:item_total_more_than_or_equal, amount: formatted_amount_max)
|
44
44
|
else
|
45
45
|
eligibility_error_message(:item_total_more_than, amount: formatted_amount_max)
|
@@ -7,6 +7,7 @@ module Spree
|
|
7
7
|
run :reload_order
|
8
8
|
run :ensure_shipping_address
|
9
9
|
run :ensure_line_items_present
|
10
|
+
run :move_order_to_delivery_state
|
10
11
|
run :generate_shipping_rates
|
11
12
|
run :return_shipments
|
12
13
|
end
|
@@ -43,6 +44,12 @@ module Spree
|
|
43
44
|
def return_shipments(order:)
|
44
45
|
success(order.shipments.includes([shipping_rates: :shipping_method]))
|
45
46
|
end
|
47
|
+
|
48
|
+
def move_order_to_delivery_state(order:)
|
49
|
+
Spree::Dependencies.checkout_next_service.constantize.call(order: order) until order.state == 'delivery'
|
50
|
+
|
51
|
+
success(order: order)
|
52
|
+
end
|
46
53
|
end
|
47
54
|
end
|
48
55
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MachineDecorator
|
4
|
+
protected
|
5
|
+
|
6
|
+
# Determines whether there's already a helper method defined within the
|
7
|
+
# given scope. This is true only if one of the owner's ancestors defines
|
8
|
+
# the method and is further along in the ancestor chain than this
|
9
|
+
# machine's helper module.
|
10
|
+
def owner_class_ancestor_has_method?(scope, method)
|
11
|
+
return false unless owner_class_has_method?(scope, method)
|
12
|
+
|
13
|
+
superclasses = owner_class.ancestors.select { |ancestor| ancestor.is_a?(Class) }[1..-1]
|
14
|
+
|
15
|
+
if scope == :class
|
16
|
+
current = owner_class.singleton_class
|
17
|
+
superclass = superclasses.first
|
18
|
+
else
|
19
|
+
current = owner_class
|
20
|
+
superclass = owner_class.superclass
|
21
|
+
end
|
22
|
+
|
23
|
+
# Generate the list of modules that *only* occur in the owner class, but
|
24
|
+
# were included *prior* to the helper modules, in addition to the
|
25
|
+
# superclasses
|
26
|
+
ancestors = current.ancestors - superclass.ancestors + superclasses
|
27
|
+
ancestors = ancestors[ancestors.index(@helper_modules[scope])..-1].reverse
|
28
|
+
|
29
|
+
# Search for for the first ancestor that defined this method
|
30
|
+
ancestors.detect do |ancestor|
|
31
|
+
ancestor = ancestor.singleton_class if scope == :class && ancestor.is_a?(Class)
|
32
|
+
ancestor.method_defined?(method) || ancestor.private_method_defined?(method)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
::StateMachines::Machine.prepend MachineDecorator
|
data/lib/spree/core/version.rb
CHANGED
@@ -145,6 +145,14 @@ module CapybaraExt
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
+
def wait_for(options = {})
|
149
|
+
default_options = { error: nil, seconds: 5 }.merge(options)
|
150
|
+
|
151
|
+
Selenium::WebDriver::Wait.new(timeout: default_options[:seconds]).until { yield }
|
152
|
+
rescue Selenium::WebDriver::Error::TimeOutError
|
153
|
+
default_options[:error].nil? ? false : raise(default_options[:error])
|
154
|
+
end
|
155
|
+
|
148
156
|
Capybara.configure do |config|
|
149
157
|
config.match = :prefer_exact
|
150
158
|
config.ignore_hidden_elements = true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.7.
|
4
|
+
version: 3.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -639,6 +639,7 @@ files:
|
|
639
639
|
- config/initializers/friendly_id.rb
|
640
640
|
- config/initializers/premailer_assets.rb
|
641
641
|
- config/initializers/premailer_rails.rb
|
642
|
+
- config/initializers/state_machine.rb
|
642
643
|
- config/initializers/use_paperclip.rb
|
643
644
|
- config/locales/en.yml
|
644
645
|
- config/routes.rb
|