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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.5 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Project member activity', :js, feature_category: :users 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)
2021-04-29 21:17:54 +05:30
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
2020-06-23 00:09:42 +05:30
visit_activities_and_wait_with_event(:joined)
2017-09-10 17:25:29 +05:30
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
2020-06-23 00:09:42 +05:30
visit_activities_and_wait_with_event(:left)
2017-09-10 17:25:29 +05:30
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
2020-06-23 00:09:42 +05:30
visit_activities_and_wait_with_event(:expired)
2017-09-10 17:25:29 +05:30
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