spree_core 3.7.2 → 3.7.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2aebe22e0a667ec8af1d2d93c6e8b61e7632b42c3cd5daf6bf9854dce6e8de70
4
- data.tar.gz: 6436afb8bd363314d87c59062354e62adae62c9ca871d4e61d2211bc59d8fffc
3
+ metadata.gz: d659f0992a4f2aa8af409c5cbd50f1e824b39bae09cc69a107990abf4e557120
4
+ data.tar.gz: 41babfa431effea64e542e2698f6ed74054e489e5f5075e2841590fd76857b7a
5
5
  SHA512:
6
- metadata.gz: 9403530f8211a89b26b0d579176a44c444c63279311c996c5b737208dd4b6e952f5940ab8fb49c3290ae7f35efd7b36f17e42947572755746817471e266bfdab
7
- data.tar.gz: 17a9a46be73ce49d828ea879050539cb5fe6493dc8570db6eedc87ae3f153f9dad121c1500ca674da412136100135ee8cf35a3f52b9582daeb2d4ae1f7401cc3
6
+ metadata.gz: 0ca1f7d8862e25123578e339dab67e71259a9572ebb3edb28e7c4e720b5d2f4e34b2accf904aa6cf59468aeb2137cbb38268f22517d4d58efd01d4051b753022
7
+ data.tar.gz: bf207628a2fbff24f23e7bacf6f357a0b3efc95075e19ec95671a5b667a34fc314c91895e6b8e84f9ab2ed025e18c6314cae77a224e0acf7a759a0fa161a3f72
@@ -1,4 +1,4 @@
1
- require 'spree/order/checkout'
1
+ require_dependency 'spree/order/checkout'
2
2
 
3
3
  module Spree
4
4
  class Order < Spree::Base
@@ -39,7 +39,7 @@ module Spree
39
39
  end
40
40
 
41
41
  def ineligible_message_max
42
- if preferred_operator_max == 'gte'
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
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- '3.7.2'
3
+ '3.7.3'
4
4
  end
5
5
  end
@@ -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.2
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-04-09 00:00:00.000000000 Z
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