Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a bug where specialist sectors wouldn't stick
Because this code was using `defined?` to check for the presence of the `specialist_sectors` method on the edition, and the edition is wrapped in a `LocalisedModel` which technically doesn't have that method defined, the code was replacing existing specialist sectors with recommended ones. Using `respond_to?` provides the correct behaviour since it accounts for `method_missing` in `LocalisedModel` and therefore uses duck typing to figure out whether it's safe to call `specialist_sectors` on the object.
- Loading branch information
Showing
2 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 45 additions & 11 deletions
56
test/unit/services/taxons_to_legacy_associations_tagging_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters