Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix I18n::MissingTranslationData exception for checkbox 'none'
This has been a problem since #2005, but it only came to light after a production deployment. Checkbox questions have an implicit 'none' response if the user doesn't select any of the checkboxes. `CheckboxQuestionPresenter#response_labels` translates the options for display in the 'Previous answers' section at the bottom of the page. When the translation fallbacks were removed in #2005, a `I18n::MissingTranslationData` was being raised when the user did not select any checkboxes. Unfortunately, this commit [1] added a translation for the 'none' option even though the `CheckboxSampleFlow` [2] didn't have an explicit `:none` option. Note also that the `assert_page_has_content` was changed to check for 'None' instead of 'none'. In this commit, I've removed the translation for the 'none' option which gave me a failing test which replicated the problem we'd seen in production. I've fixed the failing test by adding an `if/else` statement to `CheckboxQuestionPresenter#response_labels` which effectively reintroduces the translation fallback in this very specific case. I'm not totally happy with this solution, but hopefully it'll do for now. [1]: f50ec82 [2]: https://github.com/alphagov/smart-answers/blob/master/test/fixtures/smart_answer_flows/checkbox-sample.rb
- Loading branch information