blob: b448ea16128cdcd46e7ecd4b98b178e523c0ae7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
|