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

46 lines
1.2 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-03-17 18:26:18 +05:30
project.add_master(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
subject { page.find(".event-title").text }
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
it { is_expected.to eq("#{user.name} joined project") }
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
it { is_expected.to eq("#{user.name} left project") }
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
message = "#{user.name} removed due to membership expiration from project"
is_expected.to eq(message)
end
end
end