2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
feature 'Project member activity', js: true 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
|
|
|
|
project.team << [user, :master]
|
|
|
|
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
|