Joseph Johansen
5086f2d8b5
Fix rubocop Style/Send group
2024-07-23 14:18:26 +01:00
Maikel Linke
6317fe1b71
Disable RSpec monkey patching
2024-05-09 12:24:41 +10:00
Neal Chambers
fe88a88206
Fix Style/HashSyntax
2023-09-22 09:08:50 +09:00
David Cook
c0c123a92a
Remove localized number logic from weight calculator
...
Follow-on from a46eef291c
2023-05-17 14:10:58 +02:00
Luis Ramos
23627c5453
Run rubocop -a (safe corrections) removing all exceptions so all possible fixes are applied
...
9290 issues fixed
2021-06-17 22:19:26 +01:00
Luis Ramos
2b8f0abe49
Try some mass auto-correct adding frozen-string-literal to all specs
2020-12-03 06:38:24 -08:00
Maikel
8c65498661
Merge pull request #5998 from andrewpbrett/shipping-per-pound
...
Per-pound shipping calculator
2020-10-16 15:27:57 +11:00
Andy Brett
84eb8e964d
add specs for weight calculators using lbs
2020-09-24 07:03:57 -07:00
Arun Kumar Mohan
a257a9e9d2
Replace build with build_stubbed in calculator weight model specs
2020-09-21 21:12:30 -05:00
Arun Kumar Mohan
c098ba0ce3
Replace create with build_stubbed in calculator weight model specs
2020-09-21 20:46:50 -05:00
Andy Brett
4123eb7c10
update specs; add specs to validate weight calculator preference is kg or lb
2020-09-12 11:53:45 -07:00
Andy Brett
adb29a9c8f
add preferred_unit to weight shipping calculator
2020-09-07 08:41:48 -07:00
Andy Brett
4bc3101f4d
Add specs for shipping weight calculations using lbs and oz
2020-09-03 09:11:00 -07:00
Maikel Linke
4bcd665379
Handle all line items without unit_value in weight calculation
2020-03-26 17:13:29 +11:00
Luis Ramos
24c8f38111
Restructure spec to avoid variable names with numbers
2020-03-25 15:48:57 +01:00
Luis Ramos
9af4bb9757
Use create instead of build so that we test with callbacks
2020-03-25 11:22:40 +00:00
Matt-Yorkley
ef0fb18fda
Fix calculations for weight when variant.unit_value is zero
2020-03-24 22:05:55 +01:00
Matt-Yorkley
87ee4bbebc
Add spec for current problematic behaviour
2020-03-24 20:09:54 +01:00
Matt-Yorkley
54c3c73ed2
Fix duplicate key in hash
2020-03-24 12:46:21 +01:00
luisramos0
e9e6aa77d8
Make weight calculator work for SubscriptionLineItems by making it test if line_item responds to final_weight_volume field (final_weight_volume_present?)
...
We also add logic to weight_per_variant so that we use variant.unit_value if final_weight_volume is not available but variant_unit is weight
Adapt some test case to test unit_value (in grams) instead of weight (in kgs)
2019-12-08 17:36:21 +00:00
luisramos0
0e8f167ab9
Fix spec in weight calculator tests
2019-08-02 20:44:11 +01:00
Kristina Lim
e1fce8304d
Update weight calculator and add specs
2019-07-23 23:24:00 +08:00
luisramos0
160b535e2f
Make weight calculator compute 0 for variants with unit different from weight
2019-06-18 15:21:13 +01:00
luisramos0
82955b9fe5
Make weight calculator use line_item.final_weight_volume rather than variant.weight for cases where the final weight is set manually in the BOM
2019-05-31 19:55:17 +01:00
Maikel Linke
1ea2f37c18
Support international decimals in weight calculator
...
A previous pull request added support for flexible decimal characters
when editing money amounts.
https://github.com/openfoodfoundation/openfoodnetwork/pull/1831
This pull request applies the same principle to the weight calculator
which was missed in the previous pull request.
2019-03-21 12:49:19 +11:00
luisramos0
38ff99717a
Fix bug on calculator_decorator line_items_for where input is line_item with an nil order. Adapted line_items_for so that weight_calculator.line_items_for could be removed.
2018-12-09 19:37:11 +00:00
luisramos0
9490da329a
Move Calculator::Weight from models/open_food_network/calculator to models/calculator
2018-11-07 09:54:30 +00:00
luisramos0
bf55f50a7e
Fix rubocop warnings on weight and weight_spec
2018-11-07 09:54:30 +00:00
luisramos0
275a192270
Convert specs to RSpec 3.7.1 syntax with Transpec
...
This conversion is done by Transpec 3.3.0 with the following command:
transpec spec/models/calculator/weight_spec.rb
* 3 conversions
from: == expected
to: eq(expected)
* 3 conversions
from: obj.should
to: expect(obj).to
For more details: https://github.com/yujinakayama/transpec#supported-conversions
2018-11-07 09:54:30 +00:00
luisramos0
1ef04354fd
Add capacity to weight calculator to calculate based on any object with an order (needed in spree 2 to calculate based on package)
2018-11-07 09:54:30 +00:00
Rohan Mitchell
57f7d489ff
Rename OpenFoodWeb namespace to OpenFoodNetwork
2013-10-18 17:29:55 +11:00
Rohan Mitchell
239dd29511
Weight calculator will calculate against a single line item as well as an order
2013-08-09 15:27:52 +10:00
Rohan Mitchell
9dd94eaf57
Weight shipping calculator treats variants without weight defined as zero weight
2012-08-08 15:29:47 +10:00
Rohan Mitchell
06c6422591
Fix by-weight calculator to take line item quantity into account
2012-07-23 18:49:03 +10:00
Rohan Mitchell
28d2292de0
Add by-weight shipping calculator
2012-06-29 12:46:33 +10:00