solidus_core 1.1.4 → 1.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_core might be problematic. Click here for more details.

Files changed (296) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/logo/solidus_logo.png +0 -0
  3. data/app/helpers/spree/base_helper.rb +2 -3
  4. data/app/models/concerns/spree/adjustment_source.rb +1 -1
  5. data/app/models/concerns/spree/default_price.rb +3 -1
  6. data/app/models/concerns/spree/named_type.rb +1 -1
  7. data/app/models/concerns/spree/user_methods.rb +10 -0
  8. data/app/models/spree/adjustment.rb +1 -1
  9. data/app/models/spree/adjustment_reason.rb +2 -4
  10. data/app/models/spree/app_configuration.rb +36 -0
  11. data/app/models/spree/base.rb +10 -1
  12. data/app/models/spree/calculator/tiered_percent.rb +2 -1
  13. data/app/models/spree/classification.rb +1 -1
  14. data/app/models/spree/country.rb +3 -3
  15. data/app/models/spree/credit_card.rb +2 -2
  16. data/app/models/spree/customer_return.rb +3 -4
  17. data/app/models/spree/inventory_unit.rb +13 -24
  18. data/app/models/spree/item_adjustments.rb +5 -5
  19. data/app/models/spree/line_item.rb +6 -15
  20. data/app/models/spree/log_entry.rb +1 -1
  21. data/app/models/spree/option_type.rb +4 -2
  22. data/app/models/spree/option_type_prototype.rb +6 -0
  23. data/app/models/spree/option_value.rb +1 -1
  24. data/app/models/spree/order.rb +18 -63
  25. data/app/models/spree/order/checkout.rb +4 -2
  26. data/app/models/spree/order_cancellations.rb +52 -1
  27. data/app/models/spree/order_contents.rb +1 -1
  28. data/app/models/spree/order_merger.rb +143 -0
  29. data/app/models/spree/order_shipping.rb +3 -3
  30. data/app/models/spree/order_update_attributes.rb +42 -0
  31. data/app/models/spree/order_updater.rb +1 -1
  32. data/app/models/spree/payment.rb +16 -10
  33. data/app/models/spree/payment_create.rb +68 -0
  34. data/app/models/spree/payment_method.rb +0 -1
  35. data/app/models/spree/preference.rb +1 -1
  36. data/app/models/spree/price.rb +1 -8
  37. data/app/models/spree/product.rb +9 -44
  38. data/app/models/spree/product/scopes.rb +9 -7
  39. data/app/models/spree/promotion/rules/nth_order.rb +1 -1
  40. data/app/models/spree/promotion/rules/taxon.rb +2 -1
  41. data/app/models/spree/promotion_chooser.rb +1 -0
  42. data/app/models/spree/promotion_code.rb +1 -1
  43. data/app/models/spree/promotion_rule_taxon.rb +6 -0
  44. data/app/models/spree/property.rb +2 -1
  45. data/app/models/spree/property_prototype.rb +6 -0
  46. data/app/models/spree/prototype.rb +6 -2
  47. data/app/models/spree/reimbursement.rb +10 -0
  48. data/app/models/spree/return_item/eligibility_validator/time_since_purchase.rb +1 -1
  49. data/app/models/spree/return_reason.rb +1 -7
  50. data/app/models/spree/role_user.rb +3 -5
  51. data/app/models/spree/shipment.rb +6 -11
  52. data/app/models/spree/shipping_method.rb +1 -7
  53. data/app/models/spree/shipping_rate.rb +3 -14
  54. data/app/models/spree/stock/coordinator.rb +48 -4
  55. data/app/models/spree/stock/estimator.rb +3 -6
  56. data/app/models/spree/stock/packer.rb +18 -2
  57. data/app/models/spree/stock/shipping_rate_selector.rb +16 -0
  58. data/app/models/spree/stock/shipping_rate_sorter.rb +16 -0
  59. data/app/models/spree/stock_item.rb +19 -15
  60. data/app/models/spree/stock_location.rb +2 -12
  61. data/app/models/spree/stock_transfer.rb +3 -3
  62. data/app/models/spree/store_credit.rb +2 -2
  63. data/app/models/spree/tax_category.rb +3 -2
  64. data/app/models/spree/tax_rate.rb +7 -14
  65. data/app/models/spree/taxon.rb +4 -1
  66. data/app/models/spree/taxonomy.rb +1 -1
  67. data/app/models/spree/transfer_item.rb +2 -2
  68. data/app/models/spree/unit_cancel.rb +2 -0
  69. data/app/models/spree/variant.rb +9 -14
  70. data/app/models/spree/zone.rb +6 -0
  71. data/app/models/spree/zone_member.rb +1 -4
  72. data/app/views/spree/order_mailer/cancel_email.text.erb +0 -0
  73. data/config/locales/en.yml +7 -5
  74. data/db/default/spree/countries.rb +1 -1
  75. data/db/default/spree/zones.rb +5 -11
  76. data/db/migrate/20130213191427_create_default_stock.rb +1 -1
  77. data/db/migrate/20130306181701_add_address_fields_to_stock_location.rb +1 -1
  78. data/db/migrate/20140309033438_create_store_from_preferences.rb +5 -2
  79. data/db/migrate/20141009204607_add_store_id_to_orders.rb +6 -2
  80. data/db/migrate/20141215235502_remove_extra_products_slug_index.rb +5 -0
  81. data/db/migrate/20141217215630_update_product_slug_index.rb +6 -0
  82. data/db/migrate/20150225205344_move_promotion_code_to_promotion_code_value.rb +2 -2
  83. data/db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb +10 -0
  84. data/db/migrate/20151117063249_convert_habtm_to_hmt_for_properties_prototypes.rb +17 -0
  85. data/db/migrate/20151124062500_convert_habtm_to_hmt_for_option_type_prototypes.rb +17 -0
  86. data/db/migrate/20151126063028_convert_habtm_to_hmt_for_taxons_promotion_rules.rb +15 -0
  87. data/db/migrate/20151219020209_add_stock_item_unique_index.rb +9 -0
  88. data/lib/generators/spree/dummy/dummy_generator.rb +1 -1
  89. data/lib/generators/spree/dummy/templates/rails/database.yml +1 -1
  90. data/lib/generators/spree/install/templates/config/initializers/spree.rb +25 -1
  91. data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/backend/all.js +3 -0
  92. data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/frontend/all.js +3 -0
  93. data/lib/generators/spree/install/templates/vendor/assets/stylesheets/spree/backend/all.css +3 -0
  94. data/lib/generators/spree/install/templates/vendor/assets/stylesheets/spree/frontend/all.css +3 -0
  95. data/lib/spree/core/controller_helpers/common.rb +1 -1
  96. data/lib/spree/core/controller_helpers/order.rb +1 -1
  97. data/lib/spree/core/controller_helpers/payment_parameters.rb +104 -5
  98. data/lib/spree/core/engine.rb +3 -2
  99. data/lib/spree/core/stock_configuration.rb +11 -0
  100. data/lib/spree/core/unreturned_item_charger.rb +4 -4
  101. data/lib/spree/core/version.rb +9 -1
  102. data/lib/spree/permission_sets/restricted_stock_transfer_management.rb +15 -24
  103. data/lib/spree/permitted_attributes.rb +3 -1
  104. data/lib/spree/testing_support/capybara_ext.rb +14 -40
  105. data/lib/spree/testing_support/factories.rb +0 -15
  106. data/lib/spree/testing_support/factories/address_factory.rb +3 -0
  107. data/lib/spree/testing_support/factories/adjustment_factory.rb +9 -1
  108. data/lib/spree/testing_support/factories/carton_factory.rb +4 -1
  109. data/lib/spree/testing_support/factories/customer_return_factory.rb +4 -0
  110. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +5 -0
  111. data/lib/spree/testing_support/factories/line_item_factory.rb +3 -0
  112. data/lib/spree/testing_support/factories/option_type_factory.rb +6 -0
  113. data/lib/spree/testing_support/factories/{options_factory.rb → option_value_factory.rb} +0 -5
  114. data/lib/spree/testing_support/factories/order_factory.rb +13 -3
  115. data/lib/spree/testing_support/factories/order_promotion_factory.rb +3 -0
  116. data/lib/spree/testing_support/factories/payment_factory.rb +13 -5
  117. data/lib/spree/testing_support/factories/price_factory.rb +2 -0
  118. data/lib/spree/testing_support/factories/product_factory.rb +7 -1
  119. data/lib/spree/testing_support/factories/product_option_type_factory.rb +3 -0
  120. data/lib/spree/testing_support/factories/product_property_factory.rb +3 -0
  121. data/lib/spree/testing_support/factories/promotion_code_factory.rb +3 -0
  122. data/lib/spree/testing_support/factories/promotion_factory.rb +3 -0
  123. data/lib/spree/testing_support/factories/prototype_factory.rb +2 -0
  124. data/lib/spree/testing_support/factories/refund_factory.rb +10 -5
  125. data/lib/spree/testing_support/factories/refund_reason_factory.rb +5 -0
  126. data/lib/spree/testing_support/factories/reimbursement_factory.rb +2 -0
  127. data/lib/spree/testing_support/factories/return_authorization_factory.rb +4 -4
  128. data/lib/spree/testing_support/factories/return_item_factory.rb +4 -0
  129. data/lib/spree/testing_support/factories/return_reason_factory.rb +5 -0
  130. data/lib/spree/testing_support/factories/shipment_factory.rb +6 -1
  131. data/lib/spree/testing_support/factories/shipping_method_factory.rb +22 -10
  132. data/lib/spree/testing_support/factories/shipping_rate_factory.rb +9 -0
  133. data/lib/spree/testing_support/factories/state_factory.rb +2 -0
  134. data/lib/spree/testing_support/factories/stock_item_factory.rb +4 -1
  135. data/lib/spree/testing_support/factories/stock_location_factory.rb +8 -0
  136. data/lib/spree/testing_support/factories/stock_movement_factory.rb +2 -0
  137. data/lib/spree/testing_support/factories/{stock_factory.rb → stock_package_factory.rb} +5 -10
  138. data/lib/spree/testing_support/factories/stock_packer_factory.rb +13 -0
  139. data/lib/spree/testing_support/factories/stock_transfer_factory.rb +2 -2
  140. data/lib/spree/testing_support/factories/store_credit_event_factory.rb +4 -1
  141. data/lib/spree/testing_support/factories/store_credit_factory.rb +10 -6
  142. data/lib/spree/testing_support/factories/tax_category_factory.rb +2 -0
  143. data/lib/spree/testing_support/factories/tax_rate_factory.rb +4 -0
  144. data/lib/spree/testing_support/factories/taxon_factory.rb +2 -0
  145. data/lib/spree/testing_support/factories/user_factory.rb +6 -2
  146. data/lib/spree/testing_support/factories/variant_factory.rb +5 -0
  147. data/lib/spree/testing_support/factories/variant_property_rule_condition_factory.rb +3 -0
  148. data/lib/spree/testing_support/factories/variant_property_rule_factory.rb +4 -0
  149. data/lib/spree/testing_support/factories/variant_property_rule_value_factory.rb +3 -0
  150. data/lib/spree/testing_support/factories/zone_factory.rb +6 -0
  151. data/lib/spree/testing_support/sequences.rb +9 -0
  152. data/lib/tasks/exchanges.rake +4 -3
  153. data/lib/tasks/migrations/copy_shipped_shipments_to_cartons.rake +2 -2
  154. data/solidus_core.gemspec +4 -5
  155. data/spec/helpers/base_helper_spec.rb +6 -6
  156. data/spec/helpers/order_helper_spec.rb +1 -1
  157. data/spec/helpers/products_helper_spec.rb +2 -2
  158. data/spec/helpers/taxons_helper_spec.rb +1 -1
  159. data/spec/lib/spree/core/controller_helpers/payment_parameters_spec.rb +107 -7
  160. data/spec/lib/spree/core/importer/order_spec.rb +1 -1
  161. data/spec/lib/spree/core/stock_configuration_spec.rb +16 -0
  162. data/spec/lib/spree/core/testing_support/factories/address_factory_spec.rb +24 -0
  163. data/spec/lib/spree/core/testing_support/factories/adjustment_factory_spec.rb +18 -0
  164. data/spec/lib/spree/core/testing_support/factories/adjustment_reason_factory_spec.rb +12 -0
  165. data/spec/lib/spree/core/testing_support/factories/calculator_factory_spec.rb +42 -0
  166. data/spec/lib/spree/core/testing_support/factories/carton_factory_spec.rb +12 -0
  167. data/spec/lib/spree/core/testing_support/factories/country_factory_spec.rb +12 -0
  168. data/spec/lib/spree/core/testing_support/factories/credit_card_factory_spec.rb +12 -0
  169. data/spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb +28 -0
  170. data/spec/lib/spree/core/testing_support/factories/image_factory_spec.rb +12 -0
  171. data/spec/lib/spree/core/testing_support/factories/inventory_unit_factory_spec.rb +12 -0
  172. data/spec/lib/spree/core/testing_support/factories/line_item_factory_spec.rb +12 -0
  173. data/spec/lib/spree/core/testing_support/factories/option_type_factory_spec.rb +12 -0
  174. data/spec/lib/spree/core/testing_support/factories/option_value_factory_spec.rb +12 -0
  175. data/spec/lib/spree/core/testing_support/factories/order_factory_spec.rb +49 -0
  176. data/spec/lib/spree/core/testing_support/factories/order_promotion_factory_spec.rb +12 -0
  177. data/spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb +24 -0
  178. data/spec/lib/spree/core/testing_support/factories/payment_method_factory_spec.rb +30 -0
  179. data/spec/lib/spree/core/testing_support/factories/price_factory_spec.rb +12 -0
  180. data/spec/lib/spree/core/testing_support/factories/product_factory_spec.rb +30 -0
  181. data/spec/lib/spree/core/testing_support/factories/product_option_type_factory_spec.rb +12 -0
  182. data/spec/lib/spree/core/testing_support/factories/product_property_factory_spec.rb +12 -0
  183. data/spec/lib/spree/core/testing_support/factories/promotion_category_factory_spec.rb +12 -0
  184. data/spec/lib/spree/core/testing_support/factories/promotion_code_factory_spec.rb +12 -0
  185. data/spec/lib/spree/core/testing_support/factories/promotion_factory_spec.rb +30 -0
  186. data/spec/lib/spree/core/testing_support/factories/property_factory_spec.rb +12 -0
  187. data/spec/lib/spree/core/testing_support/factories/prototype_factory_spec.rb +12 -0
  188. data/spec/lib/spree/core/testing_support/factories/refund_factory_spec.rb +12 -0
  189. data/spec/lib/spree/core/testing_support/factories/refund_reason_factory_spec.rb +12 -0
  190. data/spec/lib/spree/core/testing_support/factories/reimbursement_factory_spec.rb +12 -0
  191. data/spec/lib/spree/core/testing_support/factories/reimbursement_type_factory_spec.rb +12 -0
  192. data/spec/lib/spree/core/testing_support/factories/return_authorization_factory_spec.rb +12 -0
  193. data/spec/lib/spree/core/testing_support/factories/return_item_factory_spec.rb +18 -0
  194. data/spec/lib/spree/core/testing_support/factories/return_reason_factory_spec.rb +12 -0
  195. data/spec/lib/spree/core/testing_support/factories/role_factory_spec.rb +18 -0
  196. data/spec/lib/spree/core/testing_support/factories/shipment_factory_spec.rb +12 -0
  197. data/spec/lib/spree/core/testing_support/factories/shipping_category_factory_spec.rb +12 -0
  198. data/spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb +28 -0
  199. data/spec/lib/spree/core/testing_support/factories/shipping_rate_factory_spec.rb +12 -0
  200. data/spec/lib/spree/core/testing_support/factories/state_factory_spec.rb +12 -0
  201. data/spec/lib/spree/core/testing_support/factories/stock_item_factory_spec.rb +12 -0
  202. data/spec/lib/spree/core/testing_support/factories/stock_location_factory_spec.rb +24 -0
  203. data/spec/lib/spree/core/testing_support/factories/stock_movement_factory_spec.rb +12 -0
  204. data/spec/lib/spree/core/testing_support/factories/stock_package_factory_spec.rb +26 -0
  205. data/spec/lib/spree/core/testing_support/factories/stock_packer_factory_spec.rb +16 -0
  206. data/spec/lib/spree/core/testing_support/factories/stock_transfer_factory_spec.rb +12 -0
  207. data/spec/lib/spree/core/testing_support/factories/store_credit_category_factory_spec.rb +12 -0
  208. data/spec/lib/spree/core/testing_support/factories/store_credit_event_factory_spec.rb +42 -0
  209. data/spec/lib/spree/core/testing_support/factories/store_credit_factory_spec.rb +12 -0
  210. data/spec/lib/spree/core/testing_support/factories/store_credit_type_factory_spec.rb +18 -0
  211. data/spec/lib/spree/core/testing_support/factories/store_credit_update_reason_factory_spec.rb +12 -0
  212. data/spec/lib/spree/core/testing_support/factories/store_factory_spec.rb +12 -0
  213. data/spec/lib/spree/core/testing_support/factories/tax_category_factory_spec.rb +12 -0
  214. data/spec/lib/spree/core/testing_support/factories/tax_rate_factory_spec.rb +12 -0
  215. data/spec/lib/spree/core/testing_support/factories/taxon_factory_spec.rb +12 -0
  216. data/spec/lib/spree/core/testing_support/factories/taxonomy_factory_spec.rb +12 -0
  217. data/spec/lib/spree/core/testing_support/factories/tracker_factory_spec.rb +12 -0
  218. data/spec/lib/spree/core/testing_support/factories/user_factory_spec.rb +22 -0
  219. data/spec/lib/spree/core/testing_support/factories/variant_factory_spec.rb +36 -0
  220. data/spec/lib/spree/core/testing_support/factories/variant_property_rule_condition_factory_spec.rb +12 -0
  221. data/spec/lib/spree/core/testing_support/factories/variant_property_rule_factory_spec.rb +12 -0
  222. data/spec/lib/spree/core/testing_support/factories/variant_property_rule_value_factory_spec.rb +12 -0
  223. data/spec/lib/spree/core/testing_support/factories/zone_factory_spec.rb +18 -0
  224. data/spec/lib/spree/core/unreturned_item_charger_spec.rb +1 -1
  225. data/spec/lib/spree/core/version_spec.rb +17 -0
  226. data/spec/lib/spree/money_spec.rb +1 -1
  227. data/spec/mailers/carton_mailer_spec.rb +1 -1
  228. data/spec/mailers/order_mailer_spec.rb +1 -1
  229. data/spec/mailers/reimbursement_mailer_spec.rb +1 -3
  230. data/spec/mailers/test_mailer_spec.rb +1 -3
  231. data/spec/models/spree/address_spec.rb +4 -4
  232. data/spec/models/spree/adjustment_reason_spec.rb +1 -3
  233. data/spec/models/spree/app_configuration_spec.rb +4 -0
  234. data/spec/models/spree/calculator/price_sack_spec.rb +3 -3
  235. data/spec/models/spree/calculator/shipping/price_sack_spec.rb +3 -3
  236. data/spec/models/spree/calculator/tiered_percent_spec.rb +86 -10
  237. data/spec/models/spree/carton_spec.rb +3 -1
  238. data/spec/models/spree/classification_spec.rb +3 -3
  239. data/spec/models/spree/credit_card_spec.rb +16 -16
  240. data/spec/models/spree/customer_return_spec.rb +1 -1
  241. data/spec/models/spree/gateway/bogus_simple.rb +1 -1
  242. data/spec/models/spree/inventory_unit_spec.rb +3 -3
  243. data/spec/models/spree/item_adjustments_spec.rb +1 -1
  244. data/spec/models/spree/line_item_spec.rb +2 -2
  245. data/spec/models/spree/option_type_spec.rb +2 -2
  246. data/spec/models/spree/option_value_spec.rb +2 -2
  247. data/spec/models/spree/order/callbacks_spec.rb +1 -1
  248. data/spec/models/spree/order/checkout_spec.rb +16 -11
  249. data/spec/models/spree/order/payment_spec.rb +24 -22
  250. data/spec/models/spree/order/state_machine_spec.rb +1 -1
  251. data/spec/models/spree/order/validations_spec.rb +1 -1
  252. data/spec/models/spree/order_cancellations_spec.rb +63 -0
  253. data/spec/models/spree/order_contents_spec.rb +1 -1
  254. data/spec/models/spree/order_merger_spec.rb +133 -0
  255. data/spec/models/spree/order_spec.rb +39 -159
  256. data/spec/models/spree/order_update_attributes_spec.rb +82 -0
  257. data/spec/models/spree/order_updater_spec.rb +6 -4
  258. data/spec/models/spree/payment_create_spec.rb +131 -0
  259. data/spec/models/spree/payment_spec.rb +130 -48
  260. data/spec/models/spree/permission_sets/restricted_stock_transfer_management_spec.rb +91 -33
  261. data/spec/models/spree/product_filter_spec.rb +3 -3
  262. data/spec/models/spree/product_spec.rb +80 -26
  263. data/spec/models/spree/promotion/actions/create_adjustment_spec.rb +1 -1
  264. data/spec/models/spree/promotion/actions/create_item_adjustments_spec.rb +2 -2
  265. data/spec/models/spree/promotion/rules/nth_order_spec.rb +1 -1
  266. data/spec/models/spree/promotion/rules/user_spec.rb +2 -2
  267. data/spec/models/spree/promotion_handler/coupon_spec.rb +2 -2
  268. data/spec/models/spree/promotion_spec.rb +18 -18
  269. data/spec/models/spree/reimbursement_spec.rb +22 -0
  270. data/spec/models/spree/return_item_spec.rb +2 -2
  271. data/spec/models/spree/shipment_spec.rb +28 -12
  272. data/spec/models/spree/shipping_method_spec.rb +2 -2
  273. data/spec/models/spree/shipping_rate_spec.rb +3 -3
  274. data/spec/models/spree/stock/coordinator_spec.rb +5 -0
  275. data/spec/models/spree/stock/estimator_spec.rb +35 -1
  276. data/spec/models/spree/stock/package_spec.rb +1 -1
  277. data/spec/models/spree/stock/packer_spec.rb +2 -3
  278. data/spec/models/spree/stock/shipping_rate_selector_spec.rb +16 -0
  279. data/spec/models/spree/stock/shipping_rate_sorter_spec.rb +16 -0
  280. data/spec/models/spree/stock_item_spec.rb +5 -7
  281. data/spec/models/spree/stock_location_spec.rb +5 -9
  282. data/spec/models/spree/stock_transfer_spec.rb +33 -13
  283. data/spec/models/spree/store_credit_event_spec.rb +1 -1
  284. data/spec/models/spree/store_credit_spec.rb +1 -1
  285. data/spec/models/spree/tax_rate_spec.rb +381 -120
  286. data/spec/models/spree/taxon_spec.rb +3 -3
  287. data/spec/models/spree/transfer_item_spec.rb +4 -4
  288. data/spec/models/spree/unit_cancel_spec.rb +1 -1
  289. data/spec/models/spree/variant_spec.rb +3 -3
  290. data/spec/models/spree/zone_spec.rb +35 -1
  291. data/spec/support/concerns/working_factories.rb +9 -0
  292. data/vendor/assets/javascripts/jquery-migrate-1.0.0.js +498 -0
  293. data/vendor/assets/javascripts/jquery.payment.js +231 -80
  294. metadata +103 -27
  295. data/app/models/spree/order/currency_updater.rb +0 -40
  296. data/spec/models/spree/order/currency_updater_spec.rb +0 -32
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :return_reason, class: Spree::ReturnReason do
3
+ sequence(:name) { |n| "Defect ##{n}" }
4
+ end
5
+ end
@@ -1,3 +1,8 @@
1
+ require 'spree/testing_support/factories/order_factory'
2
+ require 'spree/testing_support/factories/stock_location_factory'
3
+ require 'spree/testing_support/factories/shipping_method_factory'
4
+ require 'spree/testing_support/factories/stock_location_factory'
5
+
1
6
  FactoryGirl.define do
2
7
  factory :shipment, class: Spree::Shipment do
3
8
  tracking 'U10000'
@@ -16,7 +21,7 @@ FactoryGirl.define do
16
21
 
17
22
  shipment.order.line_items.each do |line_item|
18
23
  line_item.quantity.times do
19
- shipment.inventory_units.create(
24
+ shipment.inventory_units.create!(
20
25
  order_id: shipment.order_id,
21
26
  variant_id: line_item.variant_id,
22
27
  line_item_id: line_item.id
@@ -1,24 +1,36 @@
1
+ require 'spree/testing_support/factories/calculator_factory'
2
+ require 'spree/testing_support/factories/shipping_category_factory'
3
+ require 'spree/testing_support/factories/zone_factory'
4
+
1
5
  FactoryGirl.define do
2
- factory :base_shipping_method, class: Spree::ShippingMethod do
3
- zones { |a| [Spree::Zone.global] }
6
+ factory(
7
+ :shipping_method,
8
+ aliases: [
9
+ :base_shipping_method
10
+ ],
11
+ class: Spree::ShippingMethod
12
+ ) do
13
+ zones do
14
+ [Spree::Zone.find_by(name: 'GlobalZone') || FactoryGirl.create(:global_zone)]
15
+ end
16
+
4
17
  name 'UPS Ground'
5
18
  code 'UPS_GROUND'
6
19
 
20
+ calculator { |s| s.association(:shipping_calculator, strategy: :build, preferred_amount: s.cost) }
21
+
22
+ transient do
23
+ cost 10.0
24
+ end
25
+
7
26
  before(:create) do |shipping_method, evaluator|
8
27
  if shipping_method.shipping_categories.empty?
9
28
  shipping_method.shipping_categories << (Spree::ShippingCategory.first || create(:shipping_category))
10
29
  end
11
30
  end
12
31
 
13
- factory :shipping_method, class: Spree::ShippingMethod do
14
- transient do
15
- cost 10.0
16
- end
17
-
18
- calculator { |s| s.association(:shipping_calculator, strategy: :build, preferred_amount: s.cost) }
19
- end
20
-
21
32
  factory :free_shipping_method, class: Spree::ShippingMethod do
33
+ cost nil
22
34
  association(:calculator, factory: :shipping_no_amount_calculator, strategy: :build)
23
35
  end
24
36
  end
@@ -0,0 +1,9 @@
1
+ require 'spree/testing_support/factories/shipping_method_factory'
2
+ require 'spree/testing_support/factories/shipment_factory'
3
+
4
+ FactoryGirl.define do
5
+ factory :shipping_rate, class: Spree::ShippingRate do
6
+ shipping_method
7
+ shipment
8
+ end
9
+ end
@@ -1,3 +1,5 @@
1
+ require 'spree/testing_support/factories/country_factory'
2
+
1
3
  FactoryGirl.define do
2
4
  factory :state, class: Spree::State do
3
5
  name 'Alabama'
@@ -1,7 +1,10 @@
1
+ require 'spree/testing_support/factories/stock_location_factory'
2
+ require 'spree/testing_support/factories/variant_factory'
3
+
1
4
  FactoryGirl.define do
2
5
  factory :stock_item, class: Spree::StockItem do
3
6
  backorderable true
4
- stock_location
7
+ association :stock_location, factory: :stock_location_without_variant_propagation
5
8
  variant
6
9
 
7
10
  after(:create) { |object| object.adjust_count_on_hand(10) }
@@ -1,3 +1,7 @@
1
+ require 'spree/testing_support/factories/country_factory'
2
+ require 'spree/testing_support/factories/state_factory'
3
+ require 'spree/testing_support/factories/product_factory'
4
+
1
5
  FactoryGirl.define do
2
6
  factory :stock_location, class: Spree::StockLocation do
3
7
  name 'NY Warehouse'
@@ -13,6 +17,10 @@ FactoryGirl.define do
13
17
  stock_location.country.states.first || stock_location.association(:state, :country => stock_location.country)
14
18
  end
15
19
 
20
+ factory :stock_location_without_variant_propagation do
21
+ propagate_all_variants false
22
+ end
23
+
16
24
  factory :stock_location_with_items do
17
25
  after(:create) do |stock_location, evaluator|
18
26
  # variant will add itself to all stock_locations in an after_create
@@ -1,3 +1,5 @@
1
+ require 'spree/testing_support/factories/stock_item_factory'
2
+
1
3
  FactoryGirl.define do
2
4
  factory :stock_movement, class: Spree::StockMovement do
3
5
  quantity 1
@@ -1,15 +1,10 @@
1
- FactoryGirl.define do
2
- # must use build()
3
- factory :stock_packer, class: Spree::Stock::Packer do
4
- transient do
5
- stock_location { build(:stock_location) }
6
- contents []
7
- end
8
-
9
- initialize_with { new(stock_location, contents) }
10
- end
1
+ require 'spree/testing_support/factories/inventory_unit_factory'
2
+ require 'spree/testing_support/factories/variant_factory'
11
3
 
4
+ FactoryGirl.define do
12
5
  factory :stock_package, class: Spree::Stock::Package do
6
+ skip_create
7
+
13
8
  transient do
14
9
  stock_location { build(:stock_location) }
15
10
  contents { [] }
@@ -0,0 +1,13 @@
1
+ require 'spree/testing_support/factories/stock_location_factory'
2
+
3
+ FactoryGirl.define do
4
+ # must use build()
5
+ factory :stock_packer, class: Spree::Stock::Packer do
6
+ transient do
7
+ stock_location { build(:stock_location) }
8
+ contents []
9
+ end
10
+
11
+ initialize_with { new(stock_location, contents) }
12
+ end
13
+ end
@@ -20,8 +20,8 @@ FactoryGirl.define do
20
20
  end
21
21
 
22
22
  factory :receivable_stock_transfer_with_items do
23
- finalized_at { Time.now }
24
- shipped_at { Time.now }
23
+ finalized_at { Time.current }
24
+ shipped_at { Time.current }
25
25
  end
26
26
  end
27
27
  end
@@ -1,6 +1,9 @@
1
+ require 'spree/testing_support/factories/store_credit_factory'
2
+ require 'spree/testing_support/factories/store_credit_update_reason_factory'
3
+
1
4
  FactoryGirl.define do
2
5
  factory :store_credit_event, class: Spree::StoreCreditEvent do
3
- store_credit { create(:store_credit) }
6
+ store_credit
4
7
  amount { 100.00 }
5
8
  authorization_code { "#{store_credit.id}-SC-20140602164814476128" }
6
9
 
@@ -1,10 +1,14 @@
1
+ require 'spree/testing_support/factories/store_credit_category_factory'
2
+ require 'spree/testing_support/factories/store_credit_type_factory'
3
+ require 'spree/testing_support/factories/user_factory'
4
+
1
5
  FactoryGirl.define do
2
6
  factory :store_credit, class: Spree::StoreCredit do
3
- user { create(:user) }
4
- created_by { create(:user) }
5
- category { create(:store_credit_category) }
6
- amount { 150.00 }
7
- currency { "USD" }
8
- credit_type { create(:primary_credit_type) }
7
+ user
8
+ association :created_by, factory: :user
9
+ association :category, factory: :store_credit_category
10
+ amount 150.00
11
+ currency "USD"
12
+ association :credit_type, factory: :primary_credit_type
9
13
  end
10
14
  end
@@ -1,3 +1,5 @@
1
+ require 'spree/testing_support/sequences'
2
+
1
3
  FactoryGirl.define do
2
4
  factory :tax_category, class: Spree::TaxCategory do
3
5
  name { "TaxCategory - #{rand(999999)}" }
@@ -1,3 +1,7 @@
1
+ require 'spree/testing_support/factories/calculator_factory'
2
+ require 'spree/testing_support/factories/tax_category_factory'
3
+ require 'spree/testing_support/factories/zone_factory'
4
+
1
5
  FactoryGirl.define do
2
6
  factory :tax_rate, class: Spree::TaxRate do
3
7
  zone
@@ -1,3 +1,5 @@
1
+ require 'spree/testing_support/factories/taxonomy_factory'
2
+
1
3
  FactoryGirl.define do
2
4
  factory :taxon, class: Spree::Taxon do
3
5
  name 'Ruby on Rails'
@@ -1,6 +1,10 @@
1
+ require 'spree/testing_support/sequences'
2
+ require 'spree/testing_support/factories/role_factory'
3
+ require 'spree/testing_support/factories/address_factory'
4
+
1
5
  FactoryGirl.define do
2
6
  sequence :user_authentication_token do |n|
3
- "xxxx#{Time.now.to_i}#{rand(1000)}#{n}xxxxxxxxxxxxx"
7
+ "xxxx#{Time.current.to_i}#{rand(1000)}#{n}xxxxxxxxxxxxx"
4
8
  end
5
9
 
6
10
  factory :user, class: Spree.user_class do
@@ -20,7 +24,7 @@ FactoryGirl.define do
20
24
  spree_roles { [Spree::Role.find_by(name: 'admin') || create(:role, name: 'admin')] }
21
25
  end
22
26
 
23
- factory :user_with_addreses do |u|
27
+ factory :user_with_addresses do |u|
24
28
  bill_address
25
29
  ship_address
26
30
  end
@@ -1,3 +1,8 @@
1
+ require 'spree/testing_support/sequences'
2
+ require 'spree/testing_support/factories/option_value_factory'
3
+ require 'spree/testing_support/factories/option_type_factory'
4
+ require 'spree/testing_support/factories/product_factory'
5
+
1
6
  FactoryGirl.define do
2
7
  sequence(:random_float) { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
3
8
 
@@ -1,3 +1,6 @@
1
+ require 'spree/testing_support/factories/option_value_factory'
2
+ require 'spree/testing_support/factories/variant_property_rule_factory'
3
+
1
4
  FactoryGirl.define do
2
5
  factory :variant_property_rule_condition, class: Spree::VariantPropertyRuleCondition do
3
6
  variant_property_rule
@@ -1,3 +1,7 @@
1
+ require 'spree/testing_support/factories/product_factory'
2
+ require 'spree/testing_support/factories/property_factory'
3
+ require 'spree/testing_support/factories/option_value_factory'
4
+
1
5
  FactoryGirl.define do
2
6
  factory :variant_property_rule, class: Spree::VariantPropertyRule do
3
7
  product
@@ -1,3 +1,6 @@
1
+ require 'spree/testing_support/factories/variant_property_rule_factory'
2
+ require 'spree/testing_support/factories/property_factory'
3
+
1
4
  FactoryGirl.define do
2
5
  factory :variant_property_rule_value, class: Spree::VariantPropertyRuleValue do
3
6
  variant_property_rule
@@ -1,3 +1,5 @@
1
+ require 'spree/testing_support/sequences'
2
+
1
3
  FactoryGirl.define do
2
4
  factory :global_zone, class: Spree::Zone do
3
5
  name 'GlobalZone'
@@ -13,5 +15,9 @@ FactoryGirl.define do
13
15
  factory :zone, class: Spree::Zone do
14
16
  name { generate(:random_string) }
15
17
  description { generate(:random_string) }
18
+
19
+ trait :with_country do
20
+ countries { [create(:country)] }
21
+ end
16
22
  end
17
23
  end
@@ -0,0 +1,9 @@
1
+ require 'factory_girl'
2
+
3
+ FactoryGirl.define do
4
+ sequence(:random_code) { Faker::Lorem.characters(10) }
5
+ sequence(:random_description) { Faker::Lorem.paragraphs(1 + Kernel.rand(5)).join("\n") }
6
+ sequence(:random_email) { Faker::Internet.email }
7
+ sequence(:random_string) { Faker::Lorem.sentence }
8
+ sequence(:sku) { |n| "SKU-#{n}" }
9
+ end
@@ -20,12 +20,13 @@ namespace :exchanges do
20
20
  begin
21
21
  item_charger.charge_for_items
22
22
  rescue Spree::UnreturnedItemCharger::ChargeFailure => e
23
- failure = {message: e.message, new_order: e.new_order.try(:number)}
24
- rescue Exception => e
25
- failure = {message: "#{e.class}: #{e.message}"}
23
+ failure = { message: e.message }
24
+ rescue => e
25
+ failure = { message: "#{e.class}: #{e.message}" }
26
26
  end
27
27
 
28
28
  if failure
29
+ failure[:new_order] = item_charger.new_order.number if item_charger.new_order
29
30
  failures << failure.merge({
30
31
  order: item_charger.original_order.number,
31
32
  shipment: shipment.number,
@@ -55,8 +55,8 @@ namespace 'spree:migrations:copy_shipped_shipments_to_cartons' do
55
55
  spree_shipping_rates.shipping_method_id,
56
56
  spree_shipments.tracking,
57
57
  spree_shipments.shipped_at,
58
- '#{Time.now.to_s(:db)}', -- created_at
59
- '#{Time.now.to_s(:db)}' -- updated_at
58
+ '#{Time.current.to_s(:db)}', -- created_at
59
+ '#{Time.current.to_s(:db)}' -- updated_at
60
60
  from spree_shipments
61
61
  left join spree_shipping_rates
62
62
  on spree_shipping_rates.shipment_id = spree_shipments.id
data/solidus_core.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
  # encoding: UTF-8
2
- version = File.read(File.expand_path("../../SOLIDUS_VERSION", __FILE__)).strip
2
+ require_relative '../core/lib/spree/core/version.rb'
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.name = 'solidus_core'
7
- s.version = version
7
+ s.version = Spree.solidus_version
8
8
  s.summary = 'Essential models, mailers, and classes for the Solidus e-commerce project.'
9
9
  s.description = s.summary
10
10
 
@@ -24,16 +24,15 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency 'awesome_nested_set', '~> 3.0.1'
25
25
  s.add_dependency 'carmen', '~> 1.0.0'
26
26
  s.add_dependency 'cancancan', '~> 1.10'
27
- s.add_dependency 'deface', '~> 1.0.0'
28
27
  s.add_dependency 'ffaker', '~> 1.16'
29
28
  s.add_dependency 'font-awesome-rails', '~> 4.0'
30
- s.add_dependency 'friendly_id', '~> 5.0.4'
29
+ s.add_dependency 'friendly_id', '~> 5.0'
31
30
  s.add_dependency 'highline', '~> 1.6.18' # Necessary for the install generator
32
31
  s.add_dependency 'json', '~> 1.7'
33
32
  s.add_dependency 'kaminari', '~> 0.15', '>= 0.15.1'
34
33
  s.add_dependency 'monetize', '~> 1.1'
35
34
  s.add_dependency 'paperclip', '~> 4.2.0'
36
- s.add_dependency 'paranoia', '~> 2.1.0'
35
+ s.add_dependency 'paranoia', '~> 2.1.4'
37
36
  s.add_dependency 'premailer-rails'
38
37
  s.add_dependency 'rails', '~> 4.2.0'
39
38
  s.add_dependency 'ransack', '~> 1.6.0'
@@ -50,7 +50,7 @@ describe Spree::BaseHelper, :type => :helper do
50
50
  end
51
51
  end
52
52
 
53
- # Regression test for #1436
53
+ # Regression test for https://github.com/spree/spree/issues/1436
54
54
  context "defining custom image helpers" do
55
55
  let(:product) { mock_model(Spree::Product, :images => [], :variant_images => []) }
56
56
  before do
@@ -61,7 +61,7 @@ describe Spree::BaseHelper, :type => :helper do
61
61
 
62
62
  it "should not raise errors when style exists" do
63
63
  ActiveSupport::Deprecation.silence do
64
- expect { very_strange_image(product) }.not_to raise_error
64
+ very_strange_image(product)
65
65
  end
66
66
  end
67
67
 
@@ -71,7 +71,7 @@ describe Spree::BaseHelper, :type => :helper do
71
71
 
72
72
  end
73
73
 
74
- # Regression test for #2034
74
+ # Regression test for https://github.com/spree/spree/issues/2034
75
75
  context "flash_message" do
76
76
  let(:flash) { {"notice" => "ok", "foo" => "foo", "bar" => "bar"} }
77
77
 
@@ -130,7 +130,7 @@ describe Spree::BaseHelper, :type => :helper do
130
130
  end
131
131
  end
132
132
 
133
- # Regression test for #2396
133
+ # Regression test for https://github.com/spree/spree/issues/2396
134
134
  context "meta_data_tags" do
135
135
  it "truncates a product description to 160 characters" do
136
136
  # Because the controller_name method returns "test"
@@ -144,7 +144,7 @@ describe Spree::BaseHelper, :type => :helper do
144
144
  end
145
145
  end
146
146
 
147
- # Regression test for #5384
147
+ # Regression test for https://github.com/spree/spree/issues/5384
148
148
  context "custom image helpers conflict with inproper statements" do
149
149
  let(:product) { mock_model(Spree::Product, :images => [], :variant_images => []) }
150
150
  before do
@@ -155,7 +155,7 @@ describe Spree::BaseHelper, :type => :helper do
155
155
 
156
156
  it "should not raise errors when helper method called" do
157
157
  ActiveSupport::Deprecation.silence do
158
- expect { foobar_image(product) }.not_to raise_error
158
+ foobar_image(product)
159
159
  end
160
160
  end
161
161
 
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module Spree
4
4
  describe Spree::OrdersHelper, :type => :helper do
5
- # Regression test for #2518 + #2323
5
+ # Regression test for https://github.com/spree/spree/issues/2518 and https://github.com/spree/spree/issues/2323
6
6
  it "truncates HTML correctly in product description" do
7
7
  product = double(:description => "<strong>" + ("a" * 95) + "</strong> This content is invisible.")
8
8
  expected = "<strong>" + ("a" * 95) + "</strong>..."