diff options
Diffstat (limited to 'spec/features/invites_spec.rb')
-rw-r--r-- | spec/features/invites_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/features/invites_spec.rb b/spec/features/invites_spec.rb index d91fae5cdfd..e7bcd7876ea 100644 --- a/spec/features/invites_spec.rb +++ b/spec/features/invites_spec.rb @@ -48,6 +48,14 @@ RSpec.describe 'Invites', :aggregate_failures do expect(page).to have_content('To accept this invitation, sign in') end + it 'pre-fills the "Username or email" field on the sign in box with the invite_email from the invite' do + expect(find_field('Username or email').value).to eq(group_invite.invite_email) + end + + it 'pre-fills the Email field on the sign up box with the invite_email from the invite' do + expect(find_field('Email').value).to eq(group_invite.invite_email) + end + it 'sign in, grants access and redirects to group page' do fill_in_sign_in_form(user) @@ -63,6 +71,8 @@ RSpec.describe 'Invites', :aggregate_failures do it 'shows message user already a member' do visit invite_path(group_invite.raw_invite_token) + + expect(page).to have_link(owner.name, href: user_url(owner)) expect(page).to have_content('However, you are already a member of this group.') end end @@ -197,8 +207,10 @@ RSpec.describe 'Invites', :aggregate_failures do it 'declines application and redirects to dashboard' do page.click_link 'Decline' + expect(current_path).to eq(dashboard_projects_path) expect(page).to have_content('You have declined the invitation to join group Owned.') + expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound end end @@ -209,7 +221,9 @@ RSpec.describe 'Invites', :aggregate_failures do it 'declines application and redirects to sign in page' do expect(current_path).to eq(new_user_session_path) + expect(page).to have_content('You have declined the invitation to join group Owned.') + expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound end end end @@ -223,9 +237,13 @@ RSpec.describe 'Invites', :aggregate_failures do end it 'grants access and redirects to group page' do + expect(group.users.include?(user)).to be false + page.click_link 'Accept invitation' + expect(current_path).to eq(group_path(group)) expect(page).to have_content('You have been granted Owner access to group Owned.') + expect(group.users.include?(user)).to be true end end end |