Describe the bug
When setting localized_active_fields to false, the follow test files have 1 or more failures.
test/integration/workarea/storefront/segments_integration_test.rb
test/models/workarea/releasable_active_test.rb
To Reproduce
Set localized_active_fields = false in initializers/workarea.rb
Run the following tests.
test/integration/workarea/storefront/segments_integration_test.rb
test/models/workarea/releasable_active_test.rb
Expected behavior
All tests should pass. In the releasable_active_test.rb, the test itself is assuming there is a mongoid localized array; this is any easy fix of the tests themselves.
In the segments_integration_test the behavior is much more subtle. From what I can tell, the active? method override in Segmentable is being pre-empted by the Mongoid active? when the underlying active field is no longer localized but a simple boolean field; so when the discount is being tested to see if it's active? (in Pricing::Discount::Collection.all) the Mongoid active? is being called instead of the Segmentable#active? The end result is that a Discount that is relying on a specific segment in order to be active is simply going by the active flag and ignoring the active segments of the request.
Workarea Setup (please complete the following information):
Workarea Version: 3.5.11
Attachments
Additional context
Add any other context about the problem here.
Describe the bug When setting localized_active_fields to false, the follow test files have 1 or more failures. test/integration/workarea/storefront/segments_integration_test.rb test/models/workarea/releasable_active_test.rb
To Reproduce Set localized_active_fields = false in initializers/workarea.rb Run the following tests. test/integration/workarea/storefront/segments_integration_test.rb test/models/workarea/releasable_active_test.rb
Expected behavior All tests should pass. In the releasable_active_test.rb, the test itself is assuming there is a mongoid localized array; this is any easy fix of the tests themselves.
In the segments_integration_test the behavior is much more subtle. From what I can tell, the active? method override in Segmentable is being pre-empted by the Mongoid active? when the underlying active field is no longer localized but a simple boolean field; so when the discount is being tested to see if it's active? (in Pricing::Discount::Collection.all) the Mongoid active? is being called instead of the Segmentable#active? The end result is that a Discount that is relying on a specific segment in order to be active is simply going by the active flag and ignoring the active segments of the request.
Workarea Setup (please complete the following information):
Attachments
Additional context Add any other context about the problem here.