Commit Graph

462 Commits

Author SHA1 Message Date
luisramos0
a57a93d414 Adapt permissions.rb and order_cycle_permissions to rails 4 2019-07-03 20:18:01 +01:00
Maikel Linke
5d3dbca9c3 Toggle features via env instead of initializer
A FeatureToggle could be switched via a class_eval in an initializer.
The initializer was installed via ofn-install. We want to get rid of
custom, untracked initializers. Here I'm changing the FeatureToggle
class to use environment variables instead.

This change needs to be followed up with a change in ofn-install to use
the new environment variable. It affects only Australian production.
2019-06-26 11:43:22 +10:00
Maikel
5b0c8bbaef Merge pull request #3836 from Matt-Yorkley/fast_and_furious2
Improve /shops, /producers, and /groups performance
2019-06-21 15:02:19 +10:00
Matt-Yorkley
aca1f92060 Adapt specs to new loading methods 2019-06-12 09:47:01 +01:00
Kristina Lim
bc6f14105e Require spec_helper.rb in spec file for OC form applicator 2019-05-28 21:26:33 +08:00
luisramos0
07854cf372 Fix a few problems introduced by rubocop auto correct 2019-05-28 12:57:29 +01:00
luisramos0
86b0d71c7e Result of rubocop auto-correct and rebuilding rubocop_manual_todo 2019-05-28 12:57:29 +01:00
luisramos0
df459a21a4 Run transpec for spec/lib 2019-05-10 01:08:34 +01:00
luisramos0
44b0592223 Move OrdercycleDistributedVariants from lib/open_food_network to app/services 2019-04-11 21:37:08 +01:00
luisramos0
96ee527f0c Rename distribution_change_validator to order_cycle_distributed_variants 2019-04-11 21:14:01 +01:00
Luis Ramos
4478d51aee Merge pull request #3668 from luisramos0/2-0-stable-Mar29
[Spree Upgrade] Merging master into 2-0-stable (4th run in Mar2019)
2019-04-09 17:46:36 +01:00
luisramos0
bb4cec1186 Fix order_and_distributor_report_spec by setting ofn shipping method the ofn v2 way 2019-04-05 22:06:44 +01:00
luisramos0
ecc60f3b61 Merge branch 'master' into 2-0-stable-Mar29 2019-04-05 15:47:46 +01:00
Pau Pérez Fabregat
b288cb00c1 Merge pull request #3654 from mkllnk/3237-spec-overrides-in-inventory-report
Test inventory report to use variant overrides
2019-04-03 11:55:33 +02:00
Kristina Lim
d866fad46e Persist variants in customer totals specs
This is to properly record the on hand quantity.
2019-03-31 18:32:09 +08:00
luisramos0
d713c755e6 Uncomment report specs so we can make them work in v2 2019-03-29 22:16:38 +00:00
luisramos0
527cfc1601 Merge branch 'master' into 2-0-stable-Mar29 2019-03-29 13:48:49 +00:00
sdbowen
0f7ef2671f Add shipping method name to orders detail report
Added column allows users to see the shipping method of each order.
2019-03-28 16:08:10 -06:00
Maikel Linke
9d4589632b Test inventory report to use variant overrides 2019-03-26 16:13:50 +11:00
Kristina Lim
46e7090d11 Group report by variant and use variant SKU
This groups the Customer Totals report by variant too (among others,
including by product), and then changes the report to use the variant
SKU not the product SKU.

This adds a spec for customer totals grouping and details, which
replaces the test specific to the SKU column.
2019-03-25 07:45:32 +08:00
Maikel Linke
7bc735eea3 Cover report content with specs 2019-03-25 04:47:13 +08:00
Maikel Linke
fdd8c06823 Style reports spec 2019-03-25 04:47:13 +08:00
Maikel Linke
856603cadd Convert specs to RSpec 3.8.0 syntax with Transpec
This conversion is done by Transpec 3.4.0 with the following command:
    transpec spec/lib/open_food_network/orders_and_fulfillments_report_spec.rb

* 8 conversions
    from: == expected
      to: eq(expected)

* 8 conversions
    from: obj.should
      to: expect(obj).to

* 1 conversion
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2019-03-25 04:47:13 +08:00
Maikel Linke
0a243ac9ca Give spec vars proper names 2019-03-25 04:47:12 +08:00
Maikel Linke
6ee27cd166 Fix spec to test the right report
Probably a copy&paste error. The PackingReport had exactly the same
spec.
2019-03-25 04:47:12 +08:00
Maikel Linke
dac4d4ff1a DRY report spec 2019-03-25 04:47:07 +08:00
luisramos0
c1d14686a6 Merge branch 'master' into 2-0-stable-Mar22 2019-03-22 10:55:17 +00:00
Maikel Linke
3803094409 Add more examples to LocalizedNumber spec 2019-03-21 12:49:19 +11:00
luisramos0
22a051e720 Enable products cache by default only in staging and production
We keep tests running by default without cache, keeping it as it was before 10a79d5a65

Additionally, cached_products_renderer no longer depends on Rails.env, so here we remove that dependency from it's spec.
2019-03-17 15:03:15 +00:00
luisramos0
60ee17204b Merge branch 'master' into 2-0-stable-Mar16 2019-03-16 16:17:38 +00:00
luisramos0
05d42d475e Make reports and subscriptions specs work without product.distributors attribute 2019-03-13 12:24:40 +00:00
luisramos0
2de6c46834 Make order.order_cycle required in cart_service. There’s no more exception for that without product_distributions. 2019-03-13 12:24:40 +00:00
Pau Pérez Fabregat
2dd55770fe Merge pull request #3569 from luisramos0/delete-more-overrides
Delete some more dead overrides and more dead code
2019-03-12 17:48:12 +01:00
luisramos0
b325cea6cb Merge branch 'master' into 2-0-stable-Mar6 2019-03-06 09:19:53 +00:00
Pau Pérez Fabregat
3ddee83be5 Merge pull request #3404 from luisramos0/2-0-disable-cache
[Spree Upgrade] Add checkbox to disable products cache
2019-03-05 14:51:11 +01: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
d7bd944af3 Fix distribution_change_validator spec 2019-03-02 13:08:35 +00:00
luisramos0
351555d4e2 Remove unused methods from add_to_cart helper and distribution change validator 2019-03-02 12:55:08 +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
45e5fed609 Improve scope_variant_to_hub code and spec by testing an invalid data state 2019-02-21 11:25:01 +00:00
Maikel Linke
5d828bd7ae Update soft-delete of products
Spree changed their way of soft-deleting products, variants and
some other models. `#destroy` is now soft-deleting and replaces
`#delete`.

This commit considers only products. Variants will follow in another
commit. The other models can be ignored, because we don't call `delete`
on them.
2019-02-19 14:25:18 +11:00
luisramos0
f0842fcbe5 Convert all calls to variant.count_on_hand to variant.on_hand 2019-02-18 21:54:07 +00:00
luisramos0
75a79717cf Adapt scope_variant_to_hub to new VO rules where on_demand nil is seen as use_producer_settings 2019-02-15 14:05:24 +00: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
acc99fc9bb Improve readability of cached_product_renderer and respective spec 2019-02-11 11:46:04 +00:00
luisramos0
1b4666fc6a Add checkbox to cache settings to disable products cache 2019-02-07 20:06:27 +00:00
Pau Pérez Fabregat
259a5b211b Merge pull request #3429 from luisramos0/2-0-in-stock
[Spree Upgrade] 3428 Fix in_stock? and shopping/variant_overrides_spec
2019-02-07 15:25:43 +01:00
luisramos0
e584fd2155 Make in_stock? work for both variants and overrides by moving it from VariantStock to variant_decorator.
Added tests for it in scope_hub_to_variant and improved VO shopping specs
2019-02-01 16:18:09 +00:00