spree_core 3.3.6 → 3.4.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/spree/base_helper.rb +17 -18
  3. data/app/helpers/spree/products_helper.rb +5 -5
  4. data/app/models/concerns/spree/calculated_adjustments.rb +4 -3
  5. data/app/models/concerns/spree/default_price.rb +4 -5
  6. data/app/models/concerns/spree/display_money.rb +1 -1
  7. data/app/models/concerns/spree/named_type.rb +1 -1
  8. data/app/models/concerns/spree/ransackable_attributes.rb +5 -6
  9. data/app/models/concerns/spree/user_address.rb +6 -6
  10. data/app/models/concerns/spree/user_methods.rb +3 -3
  11. data/app/models/concerns/spree/user_payment_source.rb +4 -2
  12. data/app/models/concerns/spree/user_reporting.rb +1 -1
  13. data/app/models/spree/ability.rb +3 -3
  14. data/app/models/spree/address.rb +13 -9
  15. data/app/models/spree/adjustable/adjuster/promotion.rb +1 -1
  16. data/app/models/spree/adjustable/adjustments_updater.rb +2 -2
  17. data/app/models/spree/adjustable/promotion_accumulator.rb +6 -4
  18. data/app/models/spree/adjustment.rb +2 -3
  19. data/app/models/spree/app_configuration.rb +5 -6
  20. data/app/models/spree/base.rb +1 -1
  21. data/app/models/spree/calculator/default_tax.rb +4 -5
  22. data/app/models/spree/calculator/flat_percent_item_total.rb +1 -1
  23. data/app/models/spree/calculator/flat_rate.rb +3 -3
  24. data/app/models/spree/calculator/flexi_rate.rb +5 -5
  25. data/app/models/spree/calculator/price_sack.rb +9 -9
  26. data/app/models/spree/calculator/shipping/flat_percent_item_total.rb +1 -1
  27. data/app/models/spree/calculator/shipping/flat_rate.rb +3 -3
  28. data/app/models/spree/calculator/shipping/flexi_rate.rb +7 -7
  29. data/app/models/spree/calculator/shipping/per_item.rb +2 -2
  30. data/app/models/spree/calculator/shipping/price_sack.rb +4 -4
  31. data/app/models/spree/calculator/tiered_flat_rate.rb +3 -2
  32. data/app/models/spree/calculator/tiered_percent.rb +4 -3
  33. data/app/models/spree/calculator.rb +4 -4
  34. data/app/models/spree/classification.rb +2 -2
  35. data/app/models/spree/credit_card.rb +1 -1
  36. data/app/models/spree/exchange.rb +4 -5
  37. data/app/models/spree/gateway/bogus.rb +20 -20
  38. data/app/models/spree/gateway/bogus_simple.rb +2 -4
  39. data/app/models/spree/gateway.rb +4 -4
  40. data/app/models/spree/image.rb +3 -3
  41. data/app/models/spree/inventory_unit.rb +30 -30
  42. data/app/models/spree/line_item.rb +7 -9
  43. data/app/models/spree/option_type.rb +1 -1
  44. data/app/models/spree/order/checkout.rb +5 -5
  45. data/app/models/spree/order/currency_updater.rb +1 -4
  46. data/app/models/spree/order/payments.rb +4 -4
  47. data/app/models/spree/order/store_credit.rb +2 -2
  48. data/app/models/spree/order.rb +11 -29
  49. data/app/models/spree/order_contents.rb +6 -5
  50. data/app/models/spree/order_inventory.rb +3 -4
  51. data/app/models/spree/order_updater.rb +13 -14
  52. data/app/models/spree/payment/processing.rb +25 -26
  53. data/app/models/spree/payment.rb +72 -79
  54. data/app/models/spree/payment_capture_event.rb +1 -1
  55. data/app/models/spree/payment_method/check.rb +1 -1
  56. data/app/models/spree/payment_method/store_credit.rb +5 -5
  57. data/app/models/spree/payment_method.rb +7 -7
  58. data/app/models/spree/preferences/configuration.rb +6 -9
  59. data/app/models/spree/preferences/preferable.rb +11 -11
  60. data/app/models/spree/preferences/preferable_class_methods.rb +2 -3
  61. data/app/models/spree/preferences/scoped_store.rb +6 -5
  62. data/app/models/spree/preferences/store.rb +9 -14
  63. data/app/models/spree/price.rb +1 -1
  64. data/app/models/spree/product/scopes.rb +49 -49
  65. data/app/models/spree/product.rb +16 -16
  66. data/app/models/spree/promotion/actions/create_item_adjustments.rb +2 -1
  67. data/app/models/spree/promotion/actions/free_shipping.rb +1 -1
  68. data/app/models/spree/promotion/rules/first_order.rb +7 -6
  69. data/app/models/spree/promotion/rules/item_total.rb +3 -5
  70. data/app/models/spree/promotion/rules/one_use_per_user.rb +1 -2
  71. data/app/models/spree/promotion/rules/option_value.rb +14 -6
  72. data/app/models/spree/promotion/rules/product.rb +4 -4
  73. data/app/models/spree/promotion/rules/taxon.rb +6 -6
  74. data/app/models/spree/promotion/rules/user.rb +3 -3
  75. data/app/models/spree/promotion/rules/user_logged_in.rb +1 -1
  76. data/app/models/spree/promotion.rb +15 -16
  77. data/app/models/spree/promotion_action.rb +1 -1
  78. data/app/models/spree/promotion_handler/cart.rb +3 -2
  79. data/app/models/spree/promotion_handler/free_shipping.rb +1 -3
  80. data/app/models/spree/promotion_handler/page.rb +3 -3
  81. data/app/models/spree/promotion_rule.rb +5 -4
  82. data/app/models/spree/refund.rb +8 -8
  83. data/app/models/spree/reimbursement/credit.rb +1 -1
  84. data/app/models/spree/reimbursement/reimbursement_type_engine.rb +1 -3
  85. data/app/models/spree/reimbursement.rb +4 -8
  86. data/app/models/spree/reimbursement_performer.rb +0 -5
  87. data/app/models/spree/reimbursement_tax_calculator.rb +5 -12
  88. data/app/models/spree/reimbursement_type.rb +2 -2
  89. data/app/models/spree/return_authorization.rb +22 -26
  90. data/app/models/spree/return_item/eligibility_validator/default.rb +3 -3
  91. data/app/models/spree/return_item/eligibility_validator/inventory_shipped.rb +2 -2
  92. data/app/models/spree/return_item/eligibility_validator/no_reimbursements.rb +2 -2
  93. data/app/models/spree/return_item/eligibility_validator/order_completed.rb +2 -2
  94. data/app/models/spree/return_item/eligibility_validator/rma_required.rb +2 -3
  95. data/app/models/spree/return_item/eligibility_validator/time_since_purchase.rb +2 -2
  96. data/app/models/spree/return_item.rb +15 -19
  97. data/app/models/spree/returns_calculator.rb +1 -2
  98. data/app/models/spree/shipment.rb +14 -35
  99. data/app/models/spree/shipment_handler.rb +10 -12
  100. data/app/models/spree/shipping_calculator.rb +5 -6
  101. data/app/models/spree/shipping_method.rb +3 -3
  102. data/app/models/spree/shipping_rate.rb +2 -2
  103. data/app/models/spree/state.rb +2 -2
  104. data/app/models/spree/stock/availability_validator.rb +1 -1
  105. data/app/models/spree/stock/content_item.rb +2 -3
  106. data/app/models/spree/stock/coordinator.rb +3 -2
  107. data/app/models/spree/stock/differentiator.rb +3 -2
  108. data/app/models/spree/stock/estimator.rb +7 -5
  109. data/app/models/spree/stock/package.rb +5 -5
  110. data/app/models/spree/stock/packer.rb +1 -1
  111. data/app/models/spree/stock/prioritizer.rb +5 -7
  112. data/app/models/spree/stock/quantifier.rb +0 -1
  113. data/app/models/spree/stock/splitter/backordered.rb +2 -4
  114. data/app/models/spree/stock/splitter/base.rb +3 -2
  115. data/app/models/spree/stock/splitter/shipping_category.rb +2 -1
  116. data/app/models/spree/stock_item.rb +1 -1
  117. data/app/models/spree/stock_location.rb +12 -11
  118. data/app/models/spree/stock_movement.rb +1 -3
  119. data/app/models/spree/stock_transfer.rb +1 -1
  120. data/app/models/spree/store.rb +4 -4
  121. data/app/models/spree/store_credit.rb +3 -3
  122. data/app/models/spree/tax_category.rb +1 -1
  123. data/app/models/spree/tax_rate.rb +10 -10
  124. data/app/models/spree/taxon.rb +13 -13
  125. data/app/models/spree/taxonomy.rb +9 -8
  126. data/app/models/spree/validations/db_maximum_length_validator.rb +2 -3
  127. data/app/models/spree/variant.rb +30 -41
  128. data/app/models/spree/zone.rb +10 -10
  129. data/app/validators/db_maximum_length_validator.rb +5 -5
  130. data/config/initializers/acts_as_taggable_on.rb +3 -3
  131. data/config/initializers/assets.rb +1 -1
  132. data/config/initializers/friendly_id.rb +1 -1
  133. data/config/initializers/premailer_assets.rb +1 -1
  134. data/config/locales/en.yml +8 -2
  135. data/db/default/spree/states.rb +1 -0
  136. data/lib/generators/spree/custom_user/custom_user_generator.rb +12 -15
  137. data/lib/generators/spree/install/install_generator.rb +45 -32
  138. data/lib/spree/core/components.rb +3 -3
  139. data/lib/spree/core/controller_helpers/auth.rb +5 -10
  140. data/lib/spree/core/controller_helpers/common.rb +2 -3
  141. data/lib/spree/core/controller_helpers/order.rb +3 -7
  142. data/lib/spree/core/controller_helpers/respond_with.rb +4 -4
  143. data/lib/spree/core/engine.rb +3 -3
  144. data/lib/spree/core/environment/calculators.rb +0 -1
  145. data/lib/spree/core/environment_extension.rb +8 -8
  146. data/lib/spree/core/importer/order.rb +64 -67
  147. data/lib/spree/core/importer/product.rb +10 -9
  148. data/lib/spree/core/product_filters.rb +17 -18
  149. data/lib/spree/core/routes.rb +2 -6
  150. data/lib/spree/core/search/base.rb +62 -59
  151. data/lib/spree/core/version.rb +1 -1
  152. data/lib/spree/core.rb +4 -6
  153. data/lib/spree/i18n.rb +3 -5
  154. data/lib/spree/localized_number.rb +0 -2
  155. data/lib/spree/migrations.rb +8 -7
  156. data/lib/spree/money.rb +3 -7
  157. data/lib/spree/permitted_attributes.rb +2 -2
  158. data/lib/spree/responder.rb +4 -5
  159. data/lib/spree/testing_support/authorization_helpers.rb +3 -3
  160. data/lib/spree/testing_support/caching.rb +5 -5
  161. data/lib/spree/testing_support/capybara_ext.rb +16 -18
  162. data/lib/spree/testing_support/common_rake.rb +8 -9
  163. data/lib/spree/testing_support/controller_requests.rb +6 -6
  164. data/lib/spree/testing_support/extension_rake.rb +2 -3
  165. data/lib/spree/testing_support/factories/address_factory.rb +1 -1
  166. data/lib/spree/testing_support/factories/adjustment_factory.rb +1 -1
  167. data/lib/spree/testing_support/factories/calculator_factory.rb +1 -1
  168. data/lib/spree/testing_support/factories/country_factory.rb +1 -1
  169. data/lib/spree/testing_support/factories/credit_card_factory.rb +1 -1
  170. data/lib/spree/testing_support/factories/customer_return_factory.rb +1 -3
  171. data/lib/spree/testing_support/factories/image_factory.rb +2 -2
  172. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +1 -1
  173. data/lib/spree/testing_support/factories/line_item_factory.rb +2 -2
  174. data/lib/spree/testing_support/factories/options_factory.rb +1 -1
  175. data/lib/spree/testing_support/factories/order_factory.rb +1 -1
  176. data/lib/spree/testing_support/factories/payment_factory.rb +1 -1
  177. data/lib/spree/testing_support/factories/payment_method_factory.rb +4 -4
  178. data/lib/spree/testing_support/factories/price_factory.rb +1 -1
  179. data/lib/spree/testing_support/factories/product_factory.rb +1 -1
  180. data/lib/spree/testing_support/factories/product_option_type_factory.rb +1 -1
  181. data/lib/spree/testing_support/factories/product_property_factory.rb +1 -1
  182. data/lib/spree/testing_support/factories/promotion_category_factory.rb +1 -2
  183. data/lib/spree/testing_support/factories/promotion_factory.rb +1 -2
  184. data/lib/spree/testing_support/factories/promotion_rule_factory.rb +1 -1
  185. data/lib/spree/testing_support/factories/property_factory.rb +1 -1
  186. data/lib/spree/testing_support/factories/prototype_factory.rb +1 -1
  187. data/lib/spree/testing_support/factories/refund_factory.rb +1 -1
  188. data/lib/spree/testing_support/factories/reimbursement_factory.rb +2 -2
  189. data/lib/spree/testing_support/factories/reimbursement_type_factory.rb +1 -1
  190. data/lib/spree/testing_support/factories/return_authorization_factory.rb +1 -1
  191. data/lib/spree/testing_support/factories/return_item_factory.rb +1 -1
  192. data/lib/spree/testing_support/factories/role_factory.rb +1 -1
  193. data/lib/spree/testing_support/factories/shipment_factory.rb +2 -2
  194. data/lib/spree/testing_support/factories/shipping_category_factory.rb +1 -1
  195. data/lib/spree/testing_support/factories/shipping_method_factory.rb +3 -3
  196. data/lib/spree/testing_support/factories/state_factory.rb +1 -1
  197. data/lib/spree/testing_support/factories/stock_factory.rb +1 -1
  198. data/lib/spree/testing_support/factories/stock_item_factory.rb +1 -1
  199. data/lib/spree/testing_support/factories/stock_location_factory.rb +2 -2
  200. data/lib/spree/testing_support/factories/stock_movement_factory.rb +1 -1
  201. data/lib/spree/testing_support/factories/store_credit_category_factory.rb +2 -2
  202. data/lib/spree/testing_support/factories/store_credit_event_factory.rb +1 -1
  203. data/lib/spree/testing_support/factories/store_credit_factory.rb +1 -1
  204. data/lib/spree/testing_support/factories/store_credit_type_factory.rb +1 -1
  205. data/lib/spree/testing_support/factories/store_factory.rb +1 -1
  206. data/lib/spree/testing_support/factories/tag_factory.rb +1 -1
  207. data/lib/spree/testing_support/factories/tax_category_factory.rb +2 -2
  208. data/lib/spree/testing_support/factories/tax_rate_factory.rb +1 -1
  209. data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
  210. data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
  211. data/lib/spree/testing_support/factories/tracker_factory.rb +1 -1
  212. data/lib/spree/testing_support/factories/user_factory.rb +1 -1
  213. data/lib/spree/testing_support/factories/variant_factory.rb +1 -2
  214. data/lib/spree/testing_support/factories/zone_factory.rb +1 -1
  215. data/lib/spree/testing_support/factories/zone_member_factory.rb +1 -1
  216. data/lib/spree/testing_support/factories.rb +3 -3
  217. data/lib/spree/testing_support/flash.rb +1 -3
  218. data/lib/spree/testing_support/i18n.rb +5 -6
  219. data/lib/spree/testing_support/kernel.rb +1 -2
  220. data/lib/spree/testing_support/order_walkthrough.rb +12 -15
  221. data/lib/spree/testing_support/preferences.rb +0 -1
  222. data/lib/tasks/core.rake +47 -56
  223. data/lib/tasks/email.rake +2 -2
  224. data/lib/tasks/exchanges.rake +5 -5
  225. data/spree_core.gemspec +1 -1
  226. metadata +5 -9
  227. data/app/models/spree/calculator/percent_per_item.rb +0 -51
  228. data/config/initializers/premailer_rails.rb +0 -3
  229. data/lib/spree/core/delegate_belongs_to.rb +0 -99
  230. data/lib/spree/testing_support/microdata.rb +0 -192
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :stock_item, class: Spree::StockItem do
3
3
  backorderable true
4
4
  stock_location
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :stock_location, class: Spree::StockLocation do
3
3
  name 'NY Warehouse'
4
4
  address1 '1600 Pennsylvania Ave NW'
@@ -14,7 +14,7 @@ FactoryBot.define do
14
14
  end
15
15
 
16
16
  factory :stock_location_with_items do
17
- after(:create) do |stock_location, evaluator|
17
+ after(:create) do |stock_location, _evaluator|
18
18
  # variant will add itself to all stock_locations in an after_create
19
19
  # creating a product will automatically create a master variant
20
20
  product_1 = create(:product)
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :stock_movement, class: Spree::StockMovement do
3
3
  quantity 1
4
4
  action 'sold'
@@ -1,6 +1,6 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :store_credit_category, class: Spree::StoreCreditCategory do
3
- name "Exchange"
3
+ name 'Exchange'
4
4
  end
5
5
 
6
6
  factory :store_credit_gift_card_category, class: Spree::StoreCreditCategory do
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :store_credit_auth_event, class: Spree::StoreCreditEvent do
3
3
  store_credit { create(:store_credit) }
4
4
  action { Spree::StoreCredit::AUTHORIZE_ACTION }
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  sequence(:store_credits_order_number) { |n| "R1000#{n}" }
3
3
 
4
4
  factory :store_credit, class: Spree::StoreCredit do
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :primary_credit_type, class: Spree::StoreCreditType do
3
3
  name Spree::StoreCreditType::DEFAULT_TYPE_NAME
4
4
  priority { '1' }
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :store, class: Spree::Store do
3
3
  sequence(:code) { |i| "spree_#{i}" }
4
4
  name 'Spree Test Store'
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :tag, class: Spree::Tag do
3
3
  sequence(:name) { |n| "Tag ##{n} - #{Kernel.rand(9999)}" }
4
4
  end
@@ -1,6 +1,6 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :tax_category, class: Spree::TaxCategory do
3
- name { "TaxCategory - #{rand(999999)}" }
3
+ name { "TaxCategory - #{rand(999_999)}" }
4
4
  description { generate(:random_string) }
5
5
  end
6
6
  end
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :tax_rate, class: Spree::TaxRate do
3
3
  zone
4
4
  amount 0.1
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :taxon, class: Spree::Taxon do
3
3
  sequence(:name) { |n| "taxon_#{n}" }
4
4
  taxonomy
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :taxonomy, class: Spree::Taxonomy do
3
3
  sequence(:name) { |n| "taxonomy_#{n}" }
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :tracker, class: Spree::Tracker do
3
3
  analytics_id 'A100'
4
4
  active true
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  sequence :user_authentication_token do |n|
3
3
  "xxxx#{Time.current.to_i}#{rand(1000)}#{n}xxxxxxxxxxxxx"
4
4
  end
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  sequence(:random_float) { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
3
3
 
4
4
  factory :base_variant, class: Spree::Variant do
@@ -34,6 +34,5 @@ FactoryBot.define do
34
34
  is_master 1
35
35
  end
36
36
  end
37
-
38
37
  end
39
38
  end
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :global_zone, class: Spree::Zone do
3
3
  name 'GlobalZone'
4
4
  description { generate(:random_string) }
@@ -1,4 +1,4 @@
1
- FactoryBot.define do
1
+ FactoryGirl.define do
2
2
  factory :zone_member, class: Spree::ZoneMember do
3
3
  zone { |member| member.association(:zone) }
4
4
  zoneable { |member| member.association(:zoneable) }
@@ -1,8 +1,8 @@
1
- require 'factory_bot'
1
+ require 'factory_girl'
2
2
 
3
3
  Spree::Zone.class_eval do
4
4
  def self.global
5
- find_by(name: 'GlobalZone') || FactoryBot.create(:global_zone)
5
+ find_by(name: 'GlobalZone') || FactoryGirl.create(:global_zone)
6
6
  end
7
7
  end
8
8
 
@@ -10,7 +10,7 @@ Dir["#{File.dirname(__FILE__)}/factories/**"].each do |f|
10
10
  load File.expand_path(f)
11
11
  end
12
12
 
13
- FactoryBot.define do
13
+ FactoryGirl.define do
14
14
  sequence(:random_string) { FFaker::Lorem.sentence }
15
15
  sequence(:random_description) { FFaker::Lorem.paragraphs(1 + Kernel.rand(5)).join("\n") }
16
16
  sequence(:random_email) { FFaker::Internet.email }
@@ -17,9 +17,7 @@ module Spree
17
17
  private
18
18
 
19
19
  def convert_flash(flash)
20
- if flash.is_a?(Symbol)
21
- flash = Spree.t(flash)
22
- end
20
+ flash = Spree.t(flash) if flash.is_a?(Symbol)
23
21
  flash
24
22
  end
25
23
  end
@@ -11,7 +11,7 @@ module Spree
11
11
  class << self
12
12
  attr_accessor :used_translations, :missing_translation_messages,
13
13
  :unused_translations, :unused_translation_messages
14
- alias_method :normal_t, :t
14
+ alias normal_t t
15
15
  end
16
16
 
17
17
  def self.t(*args)
@@ -49,7 +49,7 @@ module Spree
49
49
  self.used_translations ||= []
50
50
  self.unused_translation_messages = []
51
51
  self.unused_translations = []
52
- self.load_translations(translations)
52
+ load_translations(translations)
53
53
  translation_diff = unused_translations - used_translations
54
54
  translation_diff.each do |translation|
55
55
  Spree.unused_translation_messages << "#{translation} (#{I18n.locale})"
@@ -58,13 +58,13 @@ module Spree
58
58
 
59
59
  private
60
60
 
61
- def self.load_translations(hash, root=[])
62
- hash.each do |k,v|
61
+ def self.load_translations(hash, root = [])
62
+ hash.each do |k, v|
63
63
  if v.is_a?(Hash)
64
64
  load_translations(v, root.dup << k)
65
65
  else
66
66
  key = (root + [k]).join('.')
67
- self.unused_translations << key
67
+ unused_translations << key
68
68
  end
69
69
  end
70
70
  end
@@ -94,4 +94,3 @@ RSpec.configure do |config|
94
94
  end
95
95
  end
96
96
  end
97
-
@@ -1,7 +1,6 @@
1
1
  module Spree
2
2
  module TestingSupport
3
3
  module Kernel
4
-
5
4
  private
6
5
 
7
6
  def silence_stream(stream)
@@ -15,4 +14,4 @@ module Spree
15
14
  end
16
15
  end
17
16
  end
18
- end
17
+ end
@@ -1,31 +1,29 @@
1
1
  class OrderWalkthrough
2
2
  def self.up_to(state)
3
3
  # A default store must exist to provide store settings
4
- unless Spree::Store.exists?
5
- FactoryBot.create(:store)
6
- end
4
+ FactoryGirl.create(:store) unless Spree::Store.exists?
7
5
 
8
6
  # A payment method must exist for an order to proceed through the Address state
9
7
  unless Spree::PaymentMethod.exists?
10
- FactoryBot.create(:check_payment_method)
8
+ FactoryGirl.create(:check_payment_method)
11
9
  end
12
10
 
13
11
  # Need to create a valid zone too...
14
- zone = FactoryBot.create(:zone)
15
- country = FactoryBot.create(:country)
12
+ zone = FactoryGirl.create(:zone)
13
+ country = FactoryGirl.create(:country)
16
14
  zone.members << Spree::ZoneMember.create(zoneable: country)
17
- country.states << FactoryBot.create(:state, country: country)
15
+ country.states << FactoryGirl.create(:state, country: country)
18
16
 
19
17
  # A shipping method must exist for rates to be displayed on checkout page
20
18
  unless Spree::ShippingMethod.exists?
21
- FactoryBot.create(:shipping_method).tap do |sm|
19
+ FactoryGirl.create(:shipping_method).tap do |sm|
22
20
  sm.calculator.preferred_amount = 10
23
21
  sm.calculator.preferred_currency = Spree::Config[:currency]
24
22
  sm.calculator.save
25
23
  end
26
24
  end
27
25
 
28
- order = Spree::Order.create!(email: "spree@example.com")
26
+ order = Spree::Order.create!(email: 'spree@example.com')
29
27
  add_line_item!(order)
30
28
  order.next!
31
29
 
@@ -40,13 +38,13 @@ class OrderWalkthrough
40
38
  private
41
39
 
42
40
  def self.add_line_item!(order)
43
- FactoryBot.create(:line_item, order: order)
41
+ FactoryGirl.create(:line_item, order: order)
44
42
  order.reload
45
43
  end
46
44
 
47
45
  def self.address(order)
48
- order.bill_address = FactoryBot.create(:address, country_id: Spree::Zone.global.members.first.zoneable.id)
49
- order.ship_address = FactoryBot.create(:address, country_id: Spree::Zone.global.members.first.zoneable.id)
46
+ order.bill_address = FactoryGirl.create(:address, country_id: Spree::Zone.global.members.first.zoneable.id)
47
+ order.ship_address = FactoryGirl.create(:address, country_id: Spree::Zone.global.members.first.zoneable.id)
50
48
  order.next!
51
49
  end
52
50
 
@@ -61,12 +59,11 @@ class OrderWalkthrough
61
59
  order.next!
62
60
  end
63
61
 
64
- def self.complete(order)
65
- #noop?
62
+ def self.complete(_order)
63
+ # noop?
66
64
  end
67
65
 
68
66
  def self.states
69
67
  [:address, :delivery, :payment, :complete]
70
68
  end
71
-
72
69
  end
@@ -28,4 +28,3 @@ module Spree
28
28
  end
29
29
  end
30
30
  end
31
-
data/lib/tasks/core.rake CHANGED
@@ -4,86 +4,82 @@ namespace :db do
4
4
  desc %q{Loads a specified fixture file:
5
5
  use rake db:load_file[/absolute/path/to/sample/filename.rb]}
6
6
 
7
- task :load_file , [:file, :dir] => :environment do |t, args|
7
+ task :load_file, [:file, :dir] => :environment do |_t, args|
8
8
  file = Pathname.new(args.file)
9
9
 
10
10
  puts "loading ruby #{file}"
11
11
  require file
12
12
  end
13
13
 
14
- desc "Loads fixtures from the the dir you specify using rake db:load_dir[loadfrom]"
15
- task :load_dir , [:dir] => :environment do |t, args|
14
+ desc 'Loads fixtures from the the dir you specify using rake db:load_dir[loadfrom]'
15
+ task :load_dir, [:dir] => :environment do |_t, args|
16
16
  dir = args.dir
17
- dir = File.join(Rails.root, "db", dir) if Pathname.new(dir).relative?
17
+ dir = File.join(Rails.root, 'db', dir) if Pathname.new(dir).relative?
18
18
 
19
19
  ruby_files = {}
20
- Dir.glob(File.join(dir , '**/*.{rb}')).each do |fixture_file|
20
+ Dir.glob(File.join(dir, '**/*.{rb}')).each do |fixture_file|
21
21
  ext = File.extname fixture_file
22
22
  ruby_files[File.basename(fixture_file, '.*')] = fixture_file
23
23
  end
24
- ruby_files.sort.each do |fixture , ruby_file|
24
+ ruby_files.sort.each do |fixture, ruby_file|
25
25
  # If file exists within application it takes precendence.
26
- if File.exists?(File.join(Rails.root, "db/default/spree", "#{fixture}.rb"))
27
- ruby_file = File.expand_path(File.join(Rails.root, "db/default/spree", "#{fixture}.rb"))
26
+ if File.exist?(File.join(Rails.root, 'db/default/spree', "#{fixture}.rb"))
27
+ ruby_file = File.expand_path(File.join(Rails.root, 'db/default/spree', "#{fixture}.rb"))
28
28
  end
29
29
  # an invoke will only execute the task once
30
- Rake::Task["db:load_file"].execute( Rake::TaskArguments.new([:file], [ruby_file]) )
30
+ Rake::Task['db:load_file'].execute(Rake::TaskArguments.new([:file], [ruby_file]))
31
31
  end
32
32
  end
33
33
 
34
- desc "Migrate schema to version 0 and back up again. WARNING: Destroys all data in tables!!"
34
+ desc 'Migrate schema to version 0 and back up again. WARNING: Destroys all data in tables!!'
35
35
  task remigrate: :environment do
36
36
  require 'highline/import'
37
37
 
38
- if ENV['SKIP_NAG'] or ENV['OVERWRITE'].to_s.downcase == 'true' or agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [y/n] ")
38
+ if ENV['SKIP_NAG'] || ENV['OVERWRITE'].to_s.casecmp('true').zero? || agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [y/n] ")
39
39
 
40
40
  # Drop all tables
41
41
  ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }
42
42
 
43
43
  # Migrate upward
44
- Rake::Task["db:migrate"].invoke
44
+ Rake::Task['db:migrate'].invoke
45
45
 
46
46
  # Dump the schema
47
- Rake::Task["db:schema:dump"].invoke
47
+ Rake::Task['db:schema:dump'].invoke
48
48
  else
49
- say "Task cancelled."
49
+ say 'Task cancelled.'
50
50
  exit
51
51
  end
52
52
  end
53
53
 
54
- desc "Bootstrap is: migrating, loading defaults, sample data and seeding (for all extensions) and load_products tasks"
55
- task :bootstrap do
54
+ desc 'Bootstrap is: migrating, loading defaults, sample data and seeding (for all extensions) and load_products tasks'
55
+ task :bootstrap do
56
56
  require 'highline/import'
57
57
 
58
58
  # remigrate unless production mode (as saftey check)
59
59
  if %w[demo development test].include? Rails.env
60
- if ENV['AUTO_ACCEPT'] or agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [y/n] ")
60
+ if ENV['AUTO_ACCEPT'] || agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [y/n] ")
61
61
  ENV['SKIP_NAG'] = 'yes'
62
- Rake::Task["db:create"].invoke
63
- Rake::Task["db:remigrate"].invoke
62
+ Rake::Task['db:create'].invoke
63
+ Rake::Task['db:remigrate'].invoke
64
64
  else
65
- say "Task cancelled, exiting."
65
+ say 'Task cancelled, exiting.'
66
66
  exit
67
67
  end
68
68
  else
69
- say "NOTE: Bootstrap in production mode will not drop database before migration"
70
- Rake::Task["db:migrate"].invoke
69
+ say 'NOTE: Bootstrap in production mode will not drop database before migration'
70
+ Rake::Task['db:migrate'].invoke
71
71
  end
72
72
 
73
- ActiveRecord::Base.send(:subclasses).each do |model|
74
- model.reset_column_information
75
- end
73
+ ActiveRecord::Base.send(:subclasses).each(&:reset_column_information)
76
74
 
77
- load_defaults = Spree::Country.count == 0
78
- unless load_defaults # ask if there are already Countries => default data hass been loaded
75
+ load_defaults = Spree::Country.count == 0
76
+ unless load_defaults # ask if there are already Countries => default data hass been loaded
79
77
  load_defaults = agree('Countries present, load sample data anyways? [y/n]: ')
80
78
  end
81
- if load_defaults
82
- Rake::Task["db:seed"].invoke
83
- end
79
+ Rake::Task['db:seed'].invoke if load_defaults
84
80
 
85
- if Rails.env.production? and Spree::Product.count > 0
86
- load_sample = agree("WARNING: In Production and products exist in database, load sample data anyways? [y/n]:" )
81
+ if Rails.env.production? && Spree::Product.count > 0
82
+ load_sample = agree('WARNING: In Production and products exist in database, load sample data anyways? [y/n]:')
87
83
  else
88
84
  load_sample = true if ENV['AUTO_ACCEPT']
89
85
  load_sample = agree('Load Sample Data? [y/n]: ') unless load_sample
@@ -92,36 +88,34 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
92
88
  if load_sample
93
89
  # Reload models' attributes in case they were loaded in old migrations with wrong attributes
94
90
  ActiveRecord::Base.descendants.each(&:reset_column_information)
95
- Rake::Task["spree_sample:load"].invoke
91
+ Rake::Task['spree_sample:load'].invoke
96
92
  end
97
93
 
98
94
  puts "Bootstrap Complete.\n\n"
99
95
  end
100
96
 
101
-
102
-
103
- desc "Fix orphan line items after upgrading to Spree 3.1: only needed if you have line items attached to deleted records with Slug (product) and SKU (variant) duplicates of non-deleted records."
104
- task fix_orphan_line_items: :environment do |t, args|
97
+ desc 'Fix orphan line items after upgrading to Spree 3.1: only needed if you have line items attached to deleted records with Slug (product) and SKU (variant) duplicates of non-deleted records.'
98
+ task fix_orphan_line_items: :environment do |_t, _args|
105
99
  def get_input
106
100
  STDOUT.flush
107
101
  input = STDIN.gets.chomp
108
102
  case input.upcase
109
- when "Y"
110
- return true
103
+ when 'Y'
104
+ return true
111
105
 
112
- when "N"
113
- puts "aborting ....."
114
- return false
115
- else
116
- return true
106
+ when 'N'
107
+ puts 'aborting .....'
108
+ return false
109
+ else
110
+ return true
117
111
  end
118
112
  end
119
113
 
120
- puts "WARNING: This task will re-associate any line_items associated with deleted variants to non-deleted variants with matching SKUs. Because other attributes and product associations may switch during the re-association, this may have unintended side-effects. If this task finishes successfully, line items for old order should no longer be orphaned from their varaints. You should run this task after you have already run the db migratoin AddDiscontinuedToProductsAndVariants. If the db migration did not warn you that it was leaving deleted records in place because of duplicate SKUs, then you do not need to run this rake task."
121
- puts "Are you sure you want to continue? (Y/n):"
114
+ puts 'WARNING: This task will re-associate any line_items associated with deleted variants to non-deleted variants with matching SKUs. Because other attributes and product associations may switch during the re-association, this may have unintended side-effects. If this task finishes successfully, line items for old order should no longer be orphaned from their varaints. You should run this task after you have already run the db migratoin AddDiscontinuedToProductsAndVariants. If the db migration did not warn you that it was leaving deleted records in place because of duplicate SKUs, then you do not need to run this rake task.'
115
+ puts 'Are you sure you want to continue? (Y/n):'
122
116
 
123
117
  if get_input
124
- puts "looping through all your deleted variants ..."
118
+ puts 'looping through all your deleted variants ...'
125
119
 
126
120
  # first verify that I can really fix all of your line items
127
121
 
@@ -130,9 +124,7 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
130
124
 
131
125
  Spree::Variant.deleted.each do |variant|
132
126
  # check if this variant has any line items at all
133
- if !variant.line_items.any?
134
- next
135
- end
127
+ next if variant.line_items.none?
136
128
 
137
129
  variants_to_fix << variant
138
130
  dup_variant = Spree::Variant.find_by(sku: variant.sku)
@@ -143,8 +135,8 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
143
135
  end
144
136
  end
145
137
 
146
- if !variants_to_fix.any?
147
- abort( "ABORT: You have no deleted variants that are associated to line items. You do not need to run this raks task.")
138
+ if variants_to_fix.none?
139
+ abort('ABORT: You have no deleted variants that are associated to line items. You do not need to run this raks task.')
148
140
  end
149
141
 
150
142
  if no_live_variants_found.any?
@@ -152,18 +144,17 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
152
144
  no_live_variants_found.each do |deleted_variant|
153
145
  puts "variant id #{deleted_variant.id} (sku is '#{deleted_variant.sku}') ... no match found"
154
146
  end
155
- abort()
147
+ abort
156
148
  end
157
149
 
158
-
159
- puts "Ready to fix..."
150
+ puts 'Ready to fix...'
160
151
  variants_to_fix.each do |variant|
161
152
  dup_variant = Spree::Variant.find_by(sku: variant.sku)
162
153
  puts "Changing all line items for #{variant.sku} variant id #{variant.id} (deleted) to variant id #{dup_variant.id} (not deleted) ..."
163
154
  Spree::LineItem.unscoped.where(variant_id: variant.id).update_all(variant_id: dup_variant.id)
164
155
  end
165
156
 
166
- puts "DONE ! Your database should no longer have line items that are associated with deleted variants."
157
+ puts 'DONE ! Your database should no longer have line items that are associated with deleted variants.'
167
158
  end
168
159
  end
169
160
  end
data/lib/tasks/email.rake CHANGED
@@ -2,8 +2,8 @@ namespace :email do
2
2
  desc 'Sends test email to specified address - Example: EMAIL=spree@example.com bundle exec rake email:test'
3
3
  task test: :environment do
4
4
  unless ENV['EMAIL'].present?
5
- raise ArgumentError, "Must pass EMAIL environment variable. " \
6
- "Example: EMAIL=spree@example.com bundle exec rake email:test"
5
+ raise ArgumentError, 'Must pass EMAIL environment variable. ' \
6
+ 'Example: EMAIL=spree@example.com bundle exec rake email:test'
7
7
  end
8
8
  Spree::TestMailer.test_email(ENV['EMAIL']).deliver_now
9
9
  end
@@ -4,8 +4,8 @@ namespace :exchanges do
4
4
  task charge_unreturned_items: :environment do
5
5
  unreturned_return_items_scope = Spree::ReturnItem.awaiting_return.exchange_processed
6
6
  unreturned_return_items = unreturned_return_items_scope.joins(:exchange_inventory_units).where([
7
- "spree_inventory_units.created_at < :days_ago AND spree_inventory_units.state = :iu_state",
8
- days_ago: Spree::Config[:expedited_exchanges_days_window].days.ago, iu_state: "shipped"
7
+ 'spree_inventory_units.created_at < :days_ago AND spree_inventory_units.state = :iu_state',
8
+ days_ago: Spree::Config[:expedited_exchanges_days_window].days.ago, iu_state: 'shipped'
9
9
  ]).distinct.to_a
10
10
 
11
11
  # Determine that a return item has already been deemed unreturned and therefore charged
@@ -49,7 +49,7 @@ namespace :exchanges do
49
49
  # the original exchange shipment, not the built one
50
50
  order.shipments.destroy_all
51
51
  shipments.each { |shipment| shipment.update_attributes!(order_id: order.id) }
52
- order.update_attributes!(state: "confirm")
52
+ order.update_attributes!(state: 'confirm')
53
53
 
54
54
  order.reload.next!
55
55
  order.update_with_updater!
@@ -60,8 +60,8 @@ namespace :exchanges do
60
60
  failed_orders << order
61
61
  end
62
62
  end
63
- failure_message = failed_orders.map { |o| "#{o.number} - #{o.errors.full_messages}" }.join(", ")
64
- raise UnableToChargeForUnreturnedItems.new(failure_message) if failed_orders.present?
63
+ failure_message = failed_orders.map { |o| "#{o.number} - #{o.errors.full_messages}" }.join(', ')
64
+ raise UnableToChargeForUnreturnedItems, failure_message if failed_orders.present?
65
65
  end
66
66
  end
67
67
 
data/spree_core.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.add_dependency 'highline', '~> 1.6.18' # Necessary for the install generator
32
32
  s.add_dependency 'kaminari', '~> 1.0.1'
33
33
  s.add_dependency 'monetize', '~> 1.1'
34
- s.add_dependency 'paperclip', '~> 5.2.0'
34
+ s.add_dependency 'paperclip', '~> 5.1.0'
35
35
  s.add_dependency 'paranoia', '~> 2.3.0'
36
36
  s.add_dependency 'premailer-rails'
37
37
  s.add_dependency 'acts-as-taggable-on', '~> 5.0'
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.3.6
4
+ version: 3.4.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2017-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 5.2.0
173
+ version: 5.1.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 5.2.0
180
+ version: 5.1.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: paranoia
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -386,7 +386,6 @@ files:
386
386
  - app/models/spree/calculator/flat_rate.rb
387
387
  - app/models/spree/calculator/flexi_rate.rb
388
388
  - app/models/spree/calculator/percent_on_line_item.rb
389
- - app/models/spree/calculator/percent_per_item.rb
390
389
  - app/models/spree/calculator/price_sack.rb
391
390
  - app/models/spree/calculator/returns/default_refund_amount.rb
392
391
  - app/models/spree/calculator/shipping/flat_percent_item_total.rb
@@ -568,7 +567,6 @@ files:
568
567
  - config/initializers/assets.rb
569
568
  - config/initializers/friendly_id.rb
570
569
  - config/initializers/premailer_assets.rb
571
- - config/initializers/premailer_rails.rb
572
570
  - config/locales/en.yml
573
571
  - config/routes.rb
574
572
  - db/default/spree/countries.rb
@@ -865,7 +863,6 @@ files:
865
863
  - lib/spree/core/controller_helpers/search.rb
866
864
  - lib/spree/core/controller_helpers/store.rb
867
865
  - lib/spree/core/controller_helpers/strong_parameters.rb
868
- - lib/spree/core/delegate_belongs_to.rb
869
866
  - lib/spree/core/engine.rb
870
867
  - lib/spree/core/environment.rb
871
868
  - lib/spree/core/environment/calculators.rb
@@ -953,7 +950,6 @@ files:
953
950
  - lib/spree/testing_support/flash.rb
954
951
  - lib/spree/testing_support/i18n.rb
955
952
  - lib/spree/testing_support/kernel.rb
956
- - lib/spree/testing_support/microdata.rb
957
953
  - lib/spree/testing_support/order_walkthrough.rb
958
954
  - lib/spree/testing_support/preferences.rb
959
955
  - lib/spree/testing_support/url_helpers.rb
@@ -986,7 +982,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
986
982
  version: 1.8.23
987
983
  requirements: []
988
984
  rubyforge_project:
989
- rubygems_version: 2.6.14
985
+ rubygems_version: 2.6.12
990
986
  signing_key:
991
987
  specification_version: 4
992
988
  summary: The bare bones necessary for Spree.