LG-8697 Use StringRedacter instead of copied redact method#7683
LG-8697 Use StringRedacter instead of copied redact method#7683soniaconnolly wants to merge 37 commits intomainfrom
Conversation
Co-authored-by: Jonathan Hooper <jonathan.hooper@gsa.gov>
Co-authored-by: Jonathan Hooper <jonathan.hooper@gsa.gov>
Co-authored-by: Eric Gade <eric.gade@gsa.gov> Co-authored-by: Jonathan Hooper <jonathan.hooper@gsa.gov>
Replace resolution_info_verified with already existing resolution_info_verified Co-authored-by: Eric Gade <eric.gade@gsa.gov>
Look for proofing results in :stages, :resolution rather than :extra Co-authored-by: Eric Gade <eric.gade@gsa.gov>
Redirect back to verify_info if needed from review controller before action Proofing results exception found deeper in data structure on failure Co-authored-by: Eric Gade <eric.gade@gsa.gov> Co-authored-by: Alex Bradley <alexander.bradley@gsa.gov>
per PR feedback. This is now available for a future PR to use in PhoneController and VerifyBaseStep. Co-authored-by: Alex Bradley <alexander.bradley@gsa.gov> Co-authored-by: Eric Gade <eric.gade@gsa.gov>
changelog: Internal improvements, Flow State Machine, Add update method to new VerifyInfoController
Co-authored-by: Jonathan Hooper <jonathan.hooper@gsa.gov>
Co-authored-by: Jonathan Hooper <jonathan.hooper@gsa.gov>
Co-authored-by: Eric Gade <eric.gade@gsa.gov> Co-authored-by: Jonathan Hooper <jonathan.hooper@gsa.gov>
Replace resolution_info_verified with already existing resolution_info_verified Co-authored-by: Eric Gade <eric.gade@gsa.gov>
Look for proofing results in :stages, :resolution rather than :extra Co-authored-by: Eric Gade <eric.gade@gsa.gov>
Redirect back to verify_info if needed from review controller before action Proofing results exception found deeper in data structure on failure Co-authored-by: Eric Gade <eric.gade@gsa.gov> Co-authored-by: Alex Bradley <alexander.bradley@gsa.gov>
per PR feedback. This is now available for a future PR to use in PhoneController and VerifyBaseStep. Co-authored-by: Alex Bradley <alexander.bradley@gsa.gov> Co-authored-by: Eric Gade <eric.gade@gsa.gov>
changelog: Internal, Flow State Machine, Add update action for new VerifyInfoController
Also adding the wait template Co-authored-by: Sonia Connolly <sonia.connolly@gsa.gov> Co-authored-by: Alex Bradley <alexander.bradley@gsa.gov> [skip changelog]
[skip changelog]
Move test from NewPhoneForm to new StringRedacter spec
| params.fetch(:user, {})[:password].presence | ||
| end | ||
|
|
||
| def confirm_verify_info_complete |
There was a problem hiding this comment.
Is this related to the changes for string redaction?
There was a problem hiding this comment.
Nope, base branch issues like @zachmargolis pointed out below.
|
I'd recommend changing the base on this Pull Request (to |
| @@ -0,0 +1,7 @@ | |||
| module StringRedacter | |||
| extend ActiveSupport::Concern | |||
There was a problem hiding this comment.
| extend ActiveSupport::Concern | |
| module_function |
Personally I'd go with a static method so we'd reference this directly like StringRedacter.redact_alphanumeric('abcdef') instead of just redact_alphanumeric, one of the advantages is that it's easier to see where this comes from at call sites.
| @@ -0,0 +1,15 @@ | |||
| require 'rails_helper' | |||
|
|
|||
| describe 'StringRedacter' do | |||
There was a problem hiding this comment.
looks like in the branch base switch, the StrictRedacter definition itself seems to have disappeared?
There was a problem hiding this comment.
Thanks for keeping an eye on this! I think this is going to have to wait until PR #7672 gets merged and I can branch directly from main.
There was a problem hiding this comment.
I also realized now, StringRedacter is added on that PR, but the specs, refactoring etc are all here
| module Idv | ||
| class RedactTestController < ApplicationController | ||
| include StringRedacter | ||
| end | ||
| end |
There was a problem hiding this comment.
so ruby blocks are weird, this is going to define Idv::RedactRestController in the global namespace.
When making classes in specs, I'd consider using the Class.new syntax so that the classes are anonymous and don't stay around:
let(:controller) do
Class.new(ApplicationController.new) do
include StringRedacter
end.new
end
# ...
expect(controller.redact_alphanumeric)...(also this mixin/concern business... another reason I'd consider just a static method StringRedacter.redact_alphanumeric)
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
|
Replaced with cleaned-up version #7699 |
NOTE: @zachmargolis worked on this together and finalized the code changes. I'll be closing this branch and making a new one off main with the same commits as soon as #7686 is merged.
Change VerifyBaseStep and NewPhoneForm to use the StringRedacterConcern introduced while refactoring the Flow State Machine. Reduces repetition in code and creates a place to add more redaction methods as needed.
This PR depends on the PR for LG-7400, merge that one first!
🎫 Ticket
LG-8697, subtask of LG-7401
🛠 Summary of changes
Updated VerifyBaseStep and NewPhoneForm and tests. Add new string_redacter_spec.rb with a test formerly in new_phone_form_spec.rb