Commit Graph

256 Commits

Author SHA1 Message Date
luisramos0
13d41dc1aa Remove duplicate modify entry in factories 2019-06-14 13:59:24 +01:00
luisramos0
59593c824a Fix rubocop issues in different factories 2019-06-14 13:10:53 +01:00
luisramos0
79cf03b124 Fix rubocop issues in spec/factories 2019-06-14 13:01:08 +01:00
luisramos0
a6b3c26bbe Extract users factories to separate file 2019-06-14 12:50:26 +01:00
luisramos0
8345765ada Extract tag rules factories to separate file 2019-06-14 12:49:17 +01:00
luisramos0
03fb33ba86 Extract variant factory modify to separate file 2019-06-14 12:48:04 +01:00
luisramos0
2c8ce6e4e5 Extract products factories to separate file 2019-06-14 12:45:55 +01:00
luisramos0
3e10c703bf Extract shipments factories to separate file 2019-06-14 12:43:07 +01:00
luisramos0
bd493c392a Extract shipping_methods factories to separate file 2019-06-14 12:25:10 +01:00
luisramos0
dc701f55b3 Extract calculators factories to separate file 2019-06-14 12:23:32 +01:00
luisramos0
06e3328ce2 Extract orders factories to separate file 2019-06-14 12:17:24 +01:00
luisramos0
91fcb7c7c4 Extract enterprises factories to separate file 2019-06-14 12:12:45 +01:00
luisramos0
42f2e78b10 Extract subscriptions factories to separate file 2019-06-14 12:10:54 +01:00
luisramos0
0501859c23 Extract order_cycle factories to separate file 2019-06-14 12:10:27 +01:00
Maikel Linke
5c72c35060 Use better credit card factory for subs specs
The specs for subscriptions were creating simple one-time-use credit
cards. They should not be used for subscriptions. After this was fixed
in previous commits, these integration tests failed. Now we use a new
factory that mimics stored credit cards that can be used for
subscriptions.
2019-06-11 18:01:41 +01:00
luisramos0
b780823970 Fix specs to adapt to the fact that for the order workflow to get to delivery, the shipping method must be linked to the order distributor otherwise it's ignored when creating the order shipment 2019-03-27 14:10:51 +00:00
luisramos0
428656e92e Add distributor to shipping method in factory completed_order_with_fees so that shipping method is not discarded during order processing in package.shipping_methods 2019-03-26 15:37:36 +00:00
luisramos0
287ea6038a Remove distributors from product in completed_order_with_fees factory. This setter is no longer available after product distributions has been deleted 2019-03-22 11:50:24 +00:00
luisramos0
c1d14686a6 Merge branch 'master' into 2-0-stable-Mar22 2019-03-22 10:55:17 +00:00
Luis Ramos
6cd07cd107 Merge pull request #3605 from kristinalim/fix/2788-improve_specs_for_order_syncer
[Subscriptions] (v1) Fix assertions in specs for OrderSyncer
2019-03-22 10:31:01 +00:00
Kristina Lim
0c2a75a227 Randomize bill and ship address of sample subscriptions
This also fixes some phone references in OrderSyncer specs.
2019-03-22 02:47:12 +08:00
Kristina Lim
d047e04e33 Customize addresses for subscriptions in specs
This forces us to write correct assertions when adding specs affected by
subscription addresses.
2019-03-22 01:58:27 +08:00
luisramos0
86f9b3d663 Delete product_distributions: drop table and remove models, controllers and BO edit page 2019-03-13 11:47:50 +00:00
Luis Ramos
f6ecf3de64 Merge pull request #3568 from luisramos0/2-0-improve-order-factories
[Spree Upgrade] Improve order factories
2019-03-08 09:43:26 +00:00
Luis Ramos
72e9c1d002 Merge pull request #3321 from luisramos0/2-0-delete-acct-invoices
[Spree Upgrade] Delete Accounts and Billing dead feature code until we decide we want to start using it again
2019-03-04 15:54:09 +00:00
luisramos0
d840fa7b77 Improve order factories:
- Make order_with_totals_and_distribution shorter by inheriting from order_with_distributor
- Make completed_order_with_fees more correct by inheriting only from order_with_distributor: this removes the line_item_with_shipment of order_with_totals_and_distribution that was causing an extra shipping adjustment to be kept in the order. This adjustment was being tested in the order controller spec (fixed the explanation comment in the spec which was wrong, there was no enterprise fee in this order)
2019-03-01 20:00:58 +00:00
luisramos0
a36722cebf Merge branch '2-0-stable' into 2-0-remove-variant-count-on-hand 2019-02-26 12:47:11 +00:00
luisramos0
36e2786a1e Delete Accounts and Billing dead feature code 2019-02-25 14:37:16 +00:00
luisramos0
5d51ad71b0 Merge branch 'master' into 2-0-stable-Feb20 2019-02-20 14:32:36 +00:00
luisramos0
f0842fcbe5 Convert all calls to variant.count_on_hand to variant.on_hand 2019-02-18 21:54:07 +00:00
Maikel Linke
5f5b0aaabf Simplify specs with stripe factory 2019-02-13 18:34:22 +11:00
Pau Perez
24189ca88e Create shipping_rate earlier for callback to work
If the shipping_rate is not created at the time the `#after_save`'s
`#ensure_correct_adjustment` callback is executed its call to
`shipping_method.create_adjustment` won't be executed either.

As a result, the OrderUpdater wasn't able to see any adjustments related
to the shipment causing the order total to be outdated.
2019-02-12 12:11:55 +01:00
Pau Perez
ab0b759567 Merge branch '2-0-stable' into 2-0-admin-capture-payment
* 2-0-stable: (208 commits)
  Re implement orders ctrl update method so we can change redirection logic and add specs for it
  Improve readability in admin/orders_spec
  Add line items adjustments (order.price_adjustments) to the order edit page so that user is aware of adjustments included in the price like for example tax rates
  Adapt variants auto complete to spree v2 code with shipments
  Adapt customer search override to spree v2 and fix customer details spec in admin orders spec
  Fix distributor change spec in admin orders spec
  Fix admin orders spec non tax adjustments by adapting to new view
  Fix failing specs due to Spree 2's new order admin page Add missing form tag and OC and shops injectors on order form to make the OC field, the distributor field and the update button work
  Use Spree routes
  Fix shop accidentally becoming order coordinator
  Match date format in spec with import date filter
  Make in_stock? work for both variants and overrides by moving it from VariantStock to variant_decorator.
  Add unit test for VariantStock.can_supply?
  Remove rescue from products_reset_strategy in product import: if setting count_on_hand fails the import will raise a RuntimeError
  Change product import's product_reset_strategy from depending on the inexistent variant.count_on_hand DB field and instead make individual calls to variant.count_on_hand= defined in VariantStock. Also, added spec to test return value of the reset method: it should return number of updated records.
  Upgrade views to Spree 2 and apply overrides
  Updating translations for config/locales/en_US.yml
  Update name spaces for rake tasks to shorter 'ofn'.
  Refactor checking no preview image in specs
  Refactor checking of preview image path in specs
  ...
2019-02-12 11:12:40 +01:00
luisramos0
f896e78e6f Set StockLocation.backorderable_default to false in DefaultStockLocation and in StockLocation factory.
This makes the default value of variant.on_demand false in all environments and in tests.

Additionally, adapt VariantStock.on_demand test and product factory to this change (setting on_hand value in product factory so it's not out of stock by default).
2019-01-17 20:28:05 +00:00
Pau Perez
10a678bdfe Rely on Spree's default StockLocation 2019-01-11 16:39:06 +01:00
Pau Perez
9ebe112bcc Abstract OFN's default stock location into a class 2019-01-11 15:52:09 +01:00
luisramos0
292f22af4e Adapt factory completed_order_with_fees to new parent order_with_totals_and_distribution by cleaning up duplicate shipping fees 2019-01-09 23:31:40 +00:00
luisramos0
e45f7571fb Fix order_with_totals_and_distribution by updating shipping fees 2019-01-09 15:20:28 +00:00
luisramos0
e28f9a7c84 Merge branch 'master' into 2-0-stable-jan-8th 2019-01-08 14:29:50 +00:00
Luis Ramos
116b842852 Revert "[Spree Upgrade] Set on_demand default value to false in test factories" 2019-01-03 23:54:17 +00:00
luisramos0
467623f000 Sets StockLocation.backorderable_default to false in test factories
This makes the default value of variant.on_demand be false
2018-12-26 22:16:05 +00:00
Kristina Lim
ad35ea1102 Add factory stock traits for variant overrides 2018-12-09 21:47:05 +08:00
luisramos0
e153510a71 Merge branch 'master' into 2-0-stable-nov-24th 2018-11-24 15:19:38 +00:00
Maxim Colls
f179bf8c49 Fixed Factory warning while running tests 2018-11-20 18:27:43 +00:00
luisramos0
ece21a674a Simplify completed_order_with_fees factory and make shipment_with factory an ofn factory to avoid creating extra dummy shipping_method in every test 2018-11-14 23:13:05 +00:00
luisramos0
fcdb5cd7af Merge branch 'master' into 2-0-stable-nov-8th 2018-11-08 11:18:54 +00:00
luisramos0
9490da329a Move Calculator::Weight from models/open_food_network/calculator to models/calculator 2018-11-07 09:54:30 +00:00
Luis Ramos
86721d6d42 Merge pull request #2974 from luisramos0/2-0-user-balance
[Spree Upgrade] Fix User Balance Calculator spec
2018-11-06 16:00:44 +00:00
luisramos0
79fcc7bce0 Fix user balance calculator spec by setting a target_shipment on line item of the order being tested 2018-11-05 19:23:09 +00:00
luisramos0
b16ed86b2d Fix shipping_method basic test. Adapt to spree 2 that needs shipping_categories to be set and sets them on the base factory in a after_create block, the build command was not picking it up 2018-10-27 20:34:25 +01:00