debian-mirror-gitlab/spec/features/groups/members/manage_access_requests_spec.rb

48 lines
1.4 KiB
Ruby
Raw Normal View History

require 'spec_helper'
2017-09-10 17:25:29 +05:30
feature 'Groups > Members > Manage access requests' do
let(:user) { create(:user) }
let(:owner) { create(:user) }
2017-08-17 22:00:37 +05:30
let(:group) { create(:group, :public, :access_requestable) }
background do
group.request_access(user)
group.add_owner(owner)
2017-09-10 17:25:29 +05:30
sign_in(owner)
end
scenario 'owner can see access requests' do
visit group_group_members_path(group)
expect_visible_access_request(group, user)
end
2017-09-10 17:25:29 +05:30
scenario 'owner can grant access' do
visit group_group_members_path(group)
expect_visible_access_request(group, user)
perform_enqueued_jobs { click_on 'Grant access' }
expect(ActionMailer::Base.deliveries.last.to).to eq [user.notification_email]
expect(ActionMailer::Base.deliveries.last.subject).to match "Access to the #{group.name} group was granted"
end
2017-09-10 17:25:29 +05:30
scenario 'owner can deny access' do
visit group_group_members_path(group)
expect_visible_access_request(group, user)
perform_enqueued_jobs { click_on 'Deny access' }
expect(ActionMailer::Base.deliveries.last.to).to eq [user.notification_email]
expect(ActionMailer::Base.deliveries.last.subject).to match "Access to the #{group.name} group was denied"
end
def expect_visible_access_request(group, user)
2016-08-24 12:49:21 +05:30
expect(group.requesters.exists?(user_id: user)).to be_truthy
2016-11-03 12:29:30 +05:30
expect(page).to have_content "Users requesting access to #{group.name} 1"
expect(page).to have_content user.name
end
end