Skip to content

Commit ae8e1a7

Browse files
authored
Merge branch 'main' into codex/update-uploads-index-view-with-thumbnails
2 parents b63a8a0 + 6e25092 commit ae8e1a7

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

app/controllers/concerns/better_together/wizard_methods.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ def determine_wizard_outcome # rubocop:todo Metrics/AbcSize
1515
raise StandardError, "Wizard #{wizard_identifier} was not found. Have you run the seeds?" unless wizard
1616

1717
if wizard.completed?
18-
flash[:notice] = wizard.success_message
19-
# TODO: This needs to be adjusted for private platforms. Flash message is not retained after wizard completion
20-
redirect_to wizard.success_path
18+
flash.keep(:notice)
19+
redirect_to wizard.success_path, notice: wizard.success_message
2120
else
2221
next_step_path, flash_key, message = wizard_next_step_info
2322
flash[flash_key] = message if message
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
3+
require 'rails_helper'
4+
5+
RSpec.describe 'Setup Wizard completion' do
6+
let!(:wizard) { BetterTogether::Wizard.find_by!(identifier: 'host_setup') }
7+
8+
before do
9+
wizard.mark_completed
10+
end
11+
12+
it 'redirects to the success path with notice preserved' do # rubocop:disable RSpec/MultipleExpectations
13+
get better_together.setup_wizard_path(locale: I18n.locale)
14+
expect(response).to redirect_to(wizard.success_path)
15+
16+
# The controller preserves the notice in the flash; assert it directly
17+
expect(flash[:notice]).to eq(wizard.success_message)
18+
end
19+
end

0 commit comments

Comments
 (0)