debian-mirror-gitlab/spec/features/dashboard/project_member_activity_index_spec.rb

50 lines
1.5 KiB
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'spec_helper'
2018-11-08 19:23:39 +05:30
describe 'Project member activity', :js do
2017-08-17 22:00:37 +05:30
let(:user) { create(:user) }
2017-09-10 17:25:29 +05:30
let(:project) { create(:project, :public, name: 'x', namespace: user.namespace) }
2017-08-17 22:00:37 +05:30
before do
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2017-08-17 22:00:37 +05:30
end
def visit_activities_and_wait_with_event(event_type)
Event.create(project: project, author_id: user.id, action: event_type)
2017-09-10 17:25:29 +05:30
visit activity_project_path(project)
wait_for_requests
2017-08-17 22:00:37 +05:30
end
context 'when a user joins the project' do
2017-09-10 17:25:29 +05:30
before do
visit_activities_and_wait_with_event(Event::JOINED)
end
2017-08-17 22:00:37 +05:30
2018-12-13 13:39:08 +05:30
it "presents the correct message" do
expect(page.find('.event-user-info').text).to eq("#{user.name} #{user.to_reference}")
expect(page.find('.event-title').text).to eq("joined project")
end
2017-08-17 22:00:37 +05:30
end
context 'when a user leaves the project' do
2017-09-10 17:25:29 +05:30
before do
visit_activities_and_wait_with_event(Event::LEFT)
end
2017-08-17 22:00:37 +05:30
2018-12-13 13:39:08 +05:30
it "presents the correct message" do
expect(page.find('.event-user-info').text).to eq("#{user.name} #{user.to_reference}")
expect(page.find('.event-title').text).to eq("left project")
end
2017-08-17 22:00:37 +05:30
end
context 'when a users membership expires for the project' do
2017-09-10 17:25:29 +05:30
before do
visit_activities_and_wait_with_event(Event::EXPIRED)
end
2017-08-17 22:00:37 +05:30
it "presents the correct message" do
2018-12-13 13:39:08 +05:30
expect(page.find('.event-user-info').text).to eq("#{user.name} #{user.to_reference}")
expect(page.find('.event-title').text).to eq("removed due to membership expiration from project")
2017-08-17 22:00:37 +05:30
end
end
end