Skip to content

Commit cd9c385

Browse files
committed
Test wizard completion notice on private platforms
1 parent d285fda commit cd9c385

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
require 'rails_helper'
4+
5+
RSpec.describe 'Setup Wizard completion', type: :request do
6+
let!(:platform) { create(:better_together_platform, :host, privacy: 'private') }
7+
let!(:wizard) { BetterTogether::Wizard.find_by!(identifier: 'host_setup') }
8+
let!(:user) { create(:better_together_user, :confirmed, :platform_manager) }
9+
10+
before do
11+
wizard.mark_completed
12+
login_as(user, scope: :user)
13+
end
14+
15+
it 'redirects to the success path with notice preserved' do
16+
get better_together.setup_wizard_path(locale: I18n.locale)
17+
expect(response).to redirect_to(wizard.success_path)
18+
19+
follow_redirect!
20+
expect(response.body).to include(wizard.success_message)
21+
end
22+
end

0 commit comments

Comments
 (0)