diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-19 15:57:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-19 15:57:54 +0300 |
commit | 419c53ec62de6e97a517abd5fdd4cbde3a942a34 (patch) | |
tree | 1f43a548b46bca8a5fb8fe0c31cef1883d49c5b6 /spec/support/shared_examples/controllers/concerns/onboarding/redirectable_shared_examples.rb | |
parent | 1da20d9135b3ad9e75e65b028bffc921aaf8deb7 (diff) |
Add latest changes from gitlab-org/gitlab@16-5-stable-eev16.5.0-rc42
Diffstat (limited to 'spec/support/shared_examples/controllers/concerns/onboarding/redirectable_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/controllers/concerns/onboarding/redirectable_shared_examples.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/support/shared_examples/controllers/concerns/onboarding/redirectable_shared_examples.rb b/spec/support/shared_examples/controllers/concerns/onboarding/redirectable_shared_examples.rb new file mode 100644 index 00000000000..b448ea16128 --- /dev/null +++ b/spec/support/shared_examples/controllers/concerns/onboarding/redirectable_shared_examples.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +RSpec.shared_examples Onboarding::Redirectable do + it { is_expected.to redirect_to dashboard_projects_path } + + context 'when the new user already has any accepted group membership' do + let!(:single_member) { create(:group_member, invite_email: email) } + + it 'redirects to activity group path with a flash message' do + post_create + + expect(response).to redirect_to activity_group_path(single_member.source) + expect(controller).to set_flash[:notice].to(/You have been granted/) + end + + context 'when the new user already has more than 1 accepted group membership' do + let!(:last_member) { create(:group_member, invite_email: email) } + + it 'redirects to the last member activity group path without a flash message' do + post_create + + expect(response).to redirect_to activity_group_path(last_member.source) + expect(controller).not_to set_flash[:notice].to(/You have been granted/) + end + end + + context 'when the member has an orphaned source at the time of registering' do + before do + single_member.source.delete + end + + it { is_expected.to redirect_to dashboard_projects_path } + end + end +end |