Skip to content

Commit

Permalink
Add ReturningClientController to QuestionNavigation flow
Browse files Browse the repository at this point in the history
 v
(#172730910) Add "returning client" page
  • Loading branch information
jonsgreen authored and bvandgrift committed May 19, 2020
1 parent 466be85 commit 48d37b7
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
@@ -1,16 +1,9 @@
module Questions
class NotificationPreferenceController < QuestionsController
before_action :returning_client_guard
private

def tracking_data
@form.attributes_for(:intake).reject { |k, _| k == :sms_phone_number }
end

def returning_client_guard
if DuplicateIntakeGuard.new(current_intake).has_duplicate?
redirect_to returning_client_path
end
end
end
end
10 changes: 10 additions & 0 deletions app/controllers/questions/returning_client_controller.rb
@@ -1,5 +1,15 @@
module Questions
class ReturningClientController < QuestionsController
layout "application"

def self.show?(intake)
DuplicateIntakeGuard.new(intake).has_duplicate?
end

private

def form_class
NullForm
end
end
end
3 changes: 2 additions & 1 deletion app/lib/question_navigation.rb
Expand Up @@ -5,7 +5,7 @@ class QuestionNavigation
Questions::FileWithHelpController,
Questions::AlreadyFiledController,
Questions::FilingForStimulusController,
Questions::StimulusRecommendationController, #possible off-boarding from flow
Questions::StimulusRecommendationController, # possible off-boarding from flow
Questions::BacktaxesController,
Questions::StartWithCurrentYearController,

Expand All @@ -20,6 +20,7 @@ class QuestionNavigation
Questions::ChatWithUsController,
Questions::PhoneNumberController,
Questions::EmailAddressController,
Questions::ReturningClientController, # possible off-boarding from flow
Questions::NotificationPreferenceController,

# Consent
Expand Down
1 change: 0 additions & 1 deletion config/routes.rb
Expand Up @@ -62,7 +62,6 @@
post "/:organization/drop-offs", to: "intake_site_drop_offs#create", as: :create_drop_off
get "/:organization/drop-off/:id", to: "intake_site_drop_offs#show", as: :show_drop_off

get "/returning-client", to: "questions/returning_client#show"
get "/identity-needed", to: "offboarding#identity_needed"
get "/other-options", to: "public_pages#other_options"
get "/maybe-ineligible", to: "public_pages#maybe_ineligible"
Expand Down
4 changes: 2 additions & 2 deletions spec/features/web_intake/returning_filer_spec.rb
Expand Up @@ -9,7 +9,7 @@
)
end

scenario "returning client tries filing again taken to signpost page", :js do
scenario "returning client tries filing again is taken to returning client signpost page" do
visit already_filed_questions_path
click_on "Yes"

Expand All @@ -19,7 +19,7 @@
fill_in "Confirm e-mail address", with: "returning@client.com"
click_on "Continue"

expect(current_path).to eq(returning_client_path)
expect(current_path).to eq(returning_client_questions_path)
click_on("Return to home")
expect(current_path).to eq(root_path)
end
Expand Down
1 change: 1 addition & 0 deletions spec/helpers/duplicate_intake_guard_spec.rb
Expand Up @@ -25,6 +25,7 @@
expect(subject).to have_duplicate
end
end

context "intake with matching phone number exists" do
let!(:existing_intake) { create(:intake, phone_number: "1234567890") }
let(:matching_intake) { create(:intake, phone_number: "1234567890") }
Expand Down

0 comments on commit 48d37b7

Please sign in to comment.