Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/controllers/concerns/better_together/wizard_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ def determine_wizard_outcome # rubocop:todo Metrics/AbcSize
raise StandardError, "Wizard #{wizard_identifier} was not found. Have you run the seeds?" unless wizard

if wizard.completed?
flash[:notice] = wizard.success_message
# TODO: This needs to be adjusted for private platforms. Flash message is not retained after wizard completion
redirect_to wizard.success_path
flash.keep(:notice)
redirect_to wizard.success_path, notice: wizard.success_message
else
next_step_path, flash_key, message = wizard_next_step_info
flash[flash_key] = message if message
Expand Down
19 changes: 19 additions & 0 deletions spec/requests/better_together/wizard_completion_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'Setup Wizard completion' do
let!(:wizard) { BetterTogether::Wizard.find_by!(identifier: 'host_setup') }

before do
wizard.mark_completed
end

it 'redirects to the success path with notice preserved' do # rubocop:disable RSpec/MultipleExpectations
get better_together.setup_wizard_path(locale: I18n.locale)
expect(response).to redirect_to(wizard.success_path)

# The controller preserves the notice in the flash; assert it directly
expect(flash[:notice]).to eq(wizard.success_message)
end
end
Loading