2016-10-06 11:19:27 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-10-03 04:35:01 -04:00
|
|
|
feature 'Project member activity', :js do
|
2016-10-06 11:19:27 -04:00
|
|
|
let(:user) { create(:user) }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, :public, name: 'x', namespace: user.namespace) }
|
2016-10-06 11:19:27 -04:00
|
|
|
|
|
|
|
before do
|
2017-12-22 03:18:28 -05:00
|
|
|
project.add_master(user)
|
2016-10-06 11:19:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def visit_activities_and_wait_with_event(event_type)
|
|
|
|
Event.create(project: project, author_id: user.id, action: event_type)
|
2017-06-29 13:06:35 -04:00
|
|
|
visit activity_project_path(project)
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2016-10-06 11:19:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
subject { page.find(".event-title").text }
|
|
|
|
|
|
|
|
context 'when a user joins the project' do
|
2017-06-14 14:18:56 -04:00
|
|
|
before do
|
|
|
|
visit_activities_and_wait_with_event(Event::JOINED)
|
|
|
|
end
|
2016-10-06 11:19:27 -04:00
|
|
|
|
2017-04-07 10:35:11 -04:00
|
|
|
it { is_expected.to eq("#{user.name} joined project") }
|
2016-10-06 11:19:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when a user leaves the project' do
|
2017-06-14 14:18:56 -04:00
|
|
|
before do
|
|
|
|
visit_activities_and_wait_with_event(Event::LEFT)
|
|
|
|
end
|
2016-10-06 11:19:27 -04:00
|
|
|
|
2017-04-07 10:35:11 -04:00
|
|
|
it { is_expected.to eq("#{user.name} left project") }
|
2016-10-06 11:19:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when a users membership expires for the project' do
|
2017-06-14 14:18:56 -04:00
|
|
|
before do
|
|
|
|
visit_activities_and_wait_with_event(Event::EXPIRED)
|
|
|
|
end
|
2016-10-06 11:19:27 -04:00
|
|
|
|
|
|
|
it "presents the correct message" do
|
2017-04-07 10:35:11 -04:00
|
|
|
message = "#{user.name} removed due to membership expiration from project"
|
2016-10-06 11:19:27 -04:00
|
|
|
is_expected.to eq(message)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|