gitlab-org--gitlab-foss/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

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Project member activity', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :public, name: 'x', namespace: user.namespace) }
before do
project.add_maintainer(user)
end
def visit_activities_and_wait_with_event(event_type)
Event.create!(project: project, author_id: user.id, action: event_type)
visit activity_project_path(project)
wait_for_requests
end
context 'when a user joins the project' do
before do
visit_activities_and_wait_with_event(:joined)
end
2018-11-06 09:33:42 -05:00
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
end
context 'when a user leaves the project' do
before do
visit_activities_and_wait_with_event(:left)
end
2018-11-06 09:33:42 -05:00
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
end
context 'when a users membership expires for the project' do
before do
visit_activities_and_wait_with_event(:expired)
end
it "presents the correct message" do
2018-11-06 09:33:42 -05:00
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")
end
end
end