Commit Graph

45 Commits

Author SHA1 Message Date
Gaetan Craig-Riou
2a0caca570 Refactor EnterpriseFee.clear_all_adjustments
Renamed to clear_order_adjustments, it doesn't clear line item
adjustment
2025-04-01 13:46:34 +11:00
Gaetan Craig-Riou
02a9aaf1ec Refactor spec 2025-04-01 13:46:34 +11:00
Gaetan Craig-Riou
11e08dcc26 Revert "Update line items enterprise fee instead of deleting and recreating " 2025-03-19 09:40:02 +11:00
Gaetan Craig-Riou
f2c3ab8b03 Per review, improve test expectation 2025-03-11 10:37:49 +11:00
Gaetan Craig-Riou
e87477b679 Refactor EnterpriseFee.clear_all_adjustments
Renamed to clear_order_adjustments, it doesn't clear line item
adjustment
2025-02-10 16:28:19 +11:00
Gaetan Craig-Riou
0f1b81cc3e Refactor spec 2025-02-10 16:10:13 +11:00
drummer83
7e7ab2e36d Fix typo in "categeory" (additional e) and update specs 2024-08-23 13:20:46 +02:00
Maikel Linke
6317fe1b71 Disable RSpec monkey patching 2024-05-09 12:24:41 +10:00
Maikel Linke
bd6b0ddbf3 Enforce RSpec expect(..).not_to over to_not 2024-03-07 16:57:54 +11:00
David Cook
2107aeded1 Un-safely autocorrect RSpec/ExpectChange 2024-02-23 12:17:09 +11:00
Neal Chambers
fe88a88206 Fix Style/HashSyntax 2023-09-22 09:08:50 +09:00
Maikel
146b09dc57 Spec EnterpriseFee tax_category association
Co-authored-by: David Cook <david@redcliffs.net>
2023-08-11 10:14:47 +10:00
Maikel Linke
13b2f37884 Require EnterpriseFee.belongs_to by default 2023-08-11 10:13:09 +10:00
Mohamed ABDELLANI
6771d2e7be test enterprise fees creation with tax category inheritance flag 2023-05-11 12:46:17 +01:00
Maikel Linke
25b7f1749c Simplify error when tax rate can't be inherited
I changed the text to focus on the resolution: the user needs to choose
a tax category or a different calculator.

I associated the error to the model to prevent the attribute name from
being included in the error message. Alternatively, we could have
changed the name of the attribute to match the UI. But this error
affects the combination of two attributes, none of them is invalid on
its own.

I'm using Rails' default lazy lookup for error messages which results in
shorter code and a standard structure.

I also added a simple spec.
2023-05-11 12:46:17 +01: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
Matt-Yorkley
86977da033 Update enterprise fee test setup 2021-04-14 12:01:21 +01:00
Matt-Yorkley
15edb5b13b Remove more uses of adjustment source association in tests 2021-04-14 12:01:21 +01:00
Matt-Yorkley
e323d016a2 Simplify arguments of #create_adjustment method 2021-04-14 12:01:21 +01:00
Matt-Yorkley
3ecdfca9cf Rename fee adjustment clear-all method 2021-01-29 21:52:28 +00:00
Matt-Yorkley
6a9505cf67 Ensure adjustments can access soft-deleted originators
Note: originator is generally an EnterpriseFee or a TaxRate
2021-01-19 16:46:14 +00:00
Luis Ramos
2b8f0abe49 Try some mass auto-correct adding frozen-string-literal to all specs 2020-12-03 06:38:24 -08:00
Luis Ramos
5e8438c446 Move all calculators outside the spree namespace 2020-07-07 17:26:23 +01:00
Matt-Yorkley
f5bc120fb1 Remove without_protection: true argument from #create calls
Needed for using Strong Parameters in Rails 4
2020-02-22 14:35:10 +01:00
Matt-Yorkley
ab330e882e Remove product cache 2019-10-18 21:15:11 +01:00
luisramos0
86b0d71c7e Result of rubocop auto-correct and rebuilding rubocop_manual_todo 2019-05-28 12:57:29 +01:00
luisramos0
04801e5c2e Run transpec in spec/models 2019-05-09 22:25:29 +01:00
luisramos0
4768ca27c7 Remove all dependencies to product distributions including the validation to avoid deleting fees with product distributions 2019-03-13 11:50:35 +00:00
Hugo Daniel
5ec89dde42 Update test sentences to fit new PriceSack behavior 2018-04-04 11:25:26 +10:00
Hugo Daniel
213456f4d9 Moved PriceSack tests from per item list to per order 2018-04-04 11:25:26 +10:00
Rob Harrington
c835b4eb1a Replacing stub_model objects with actual factory generated instances 2017-11-10 08:47:12 +11:00
Rohan Mitchell
38da4c8e12 Adjustments now have state instead of locked/unlocked 2017-09-08 23:55:48 +10:00
Rohan Mitchell
24d0e4fcf8 Update specs for calculator change 2016-08-26 09:29:09 +10:00
Rohan Mitchell
422061f137 Merge branch 'master' into products-caching
Conflicts:
	app/controllers/shop_controller.rb
	app/models/enterprise_fee.rb
	app/models/order_cycle.rb
	app/models/variant_override.rb
	db/schema.rb
	lib/open_food_network/products_renderer.rb
	spec/lib/open_food_network/products_renderer_spec.rb
2016-03-03 09:42:52 +11:00
Rob Harrington
59745fbc73 EnterpriseFees can inherit tax_category from product 2016-03-02 11:56:46 +11:00
Rohan Mitchell
8bd5a36aaf Remove enterprise fee destruction cache callback - responsibility to be handled by dependent models 2016-02-24 15:05:03 +11:00
Rohan Mitchell
0c65d1ddd8 Trigger products cache refresh when enterprise fee changed or destroyed 2016-02-24 15:05:02 +11:00
Rohan Mitchell
97e49c2bdb Replace 'array.sort.should == expected.sort' pattern with match_array 2015-05-28 10:46:08 +10:00
Rohan Mitchell
4cbe434573 Remove trailing relations on destruction for EnterpriseFee and Variant 2014-04-24 13:20:15 +10:00
Rohan Mitchell
b720a1d8f2 EnterpriseFee.clear_all_adjustments_on_order clears adjustments from per-order fees 2014-02-26 14:33:28 +11:00
Rohan Mitchell
5057e236a9 Find enterprise fees with per-order calculators 2014-02-26 13:48:51 +11:00
Rohan Mitchell
febbe087e9 Find EnterpriseFees with per-item calculators 2014-02-26 10:39:39 +11:00
Rohan Mitchell
ba4d3d5d7d Removing a product from cart removes its fees 2013-08-19 12:19:03 +10:00
Rohan Mitchell
591f6a8a57 Move ProductDistribution#clear_all_enterprise_fee_adjustments_for to EnterpriseFee class 2013-08-19 10:41:14 +10:00
Rohan Mitchell
192d4993a1 Add EnterpriseFee model 2012-11-15 13:42:55 +11:00