DEFRA / ruby-services-team

Guides, info and issue management for the Ruby Services team
Other
1 stars 3 forks source link

Review intent of CanStripWhitespace concern (Tech Debt) #70

Open Cruikshanks opened 5 years ago

Cruikshanks commented 5 years ago

Originally https://eaflood.atlassian.net/browse/RUBY-153

Whilst working on a company number validation issue we identified another one with our intent for the CanStripWhitespace concern.

Each page in the journey is backed by a form which handles setting up the data to display, and validating the answers when the page is submitted.

The concern is some shared code used by all the forms, and it is used to ensure that all the values a user submits are stripped of whitespace before being saved to the database. This is general good practise and prevents issues with mis-interpretation and mis-matches when dealing with the data.

The issue is the main intent was to strip any whitespace before we then do any further processing. The issue is that we are only stripping the whitespace before saving values to the database. We are not stripping them when trying to validate the values.

Hence things like company number validation fails, because it is trying to search companies house with values that includes whitespace, and therefore finding no match.

So this story is about reviewing our intent and current solution and deciding