2016-10-06 15:19:27 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'Project member activity', feature: true, js: true do
|
|
|
|
include WaitForAjax
|
|
|
|
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:empty_project, :public, name: 'x', namespace: user.namespace) }
|
|
|
|
|
|
|
|
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-02-23 23:55:01 +00:00
|
|
|
visit activity_namespace_project_path(project.namespace, project)
|
2016-10-06 15:19:27 +00:00
|
|
|
wait_for_ajax
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { page.find(".event-title").text }
|
|
|
|
|
|
|
|
context 'when a user joins the project' do
|
|
|
|
before { visit_activities_and_wait_with_event(Event::JOINED) }
|
|
|
|
|
2017-04-03 13:33:02 +00:00
|
|
|
it { is_expected.to eq("joined project") }
|
2016-10-06 15:19:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when a user leaves the project' do
|
|
|
|
before { visit_activities_and_wait_with_event(Event::LEFT) }
|
|
|
|
|
2017-04-03 13:33:02 +00:00
|
|
|
it { is_expected.to eq("left project") }
|
2016-10-06 15:19:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when a users membership expires for the project' do
|
|
|
|
before { visit_activities_and_wait_with_event(Event::EXPIRED) }
|
|
|
|
|
|
|
|
it "presents the correct message" do
|
2017-04-03 13:33:02 +00:00
|
|
|
message = "removed due to membership expiration from project"
|
2016-10-06 15:19:27 +00:00
|
|
|
is_expected.to eq(message)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|